# Why doesn't this code work?

**URL:** <https://forum.kirupa.com/t/why-doesnt-this-code-work/87680>\
**Category:** Uncategorized\
**Created:** [April 22, 2005, 7:14pm UTC](https://forum.kirupa.com/t/why-doesnt-this-code-work/87680 "2005-04-22T19:14:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Smith](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ben_smith/32/1118_2.png) [@Ben\_Smith](https://forum.kirupa.com/u/Ben_Smith)\
**Post date:** [April 22, 2005, 7:14pm UTC](https://forum.kirupa.com/t/why-doesnt-this-code-work/87680/1 "2005-04-22T19:14:34Z")

</div>

Hey peeps,

I was just wondering, as I am still doing my blog…why this code doesn’t work:

```php
<?php
if ($_POST['insertsidebar']) //If submit is hit
{
   //then connect as user
   mysql_connect("localhost","voetsjoe_benji","FUBAR");
 
   mysql_select_db("voetsjoe_benji"); 
   //convert all the posts to variables:
   $titlesb = $_POST['titleside'];
   $linksb = $_POST['linkside'];   
   $descsb = $_POST['descside'];
   
   //Insert the values into the correct database with the right fields
mysql_query("INSERT INTO sidebar ('id','link','title','desc') VALUES ('NULL', '$linksb', '$titlesb', '$descsb')";
}
?>

```

The weird thing is that it works on another page…

Ben
