PHP inserting dropdown value into SQL database?

Cecily

New member
I am trying to insert a value chosen from a drop down menu into my SQL databse.

It doesn't error, it just doesn't work so I have nothing to go off of

//This is my drop down menu//
<select name="department" id="department">
<option value="Circ">Circ</option>
<option value="MM">MM</option>
</select>

//This is my code to post it//
$department = $_POST['department'];

$sqlquery =("UPDATE net_users SET department = $department'");
$results = mysql_query($sqlquery);

I have an echo to pull the $department and that works it just doesn't insert it into the table
I have a conntection in my config file I used the echo mysql_error thing and it is giving me a syntax error, even though I don't see the error!

//Code
$sqlquery = ("INSERT INTO net_users(department)VALUES ='$department'");

//Error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='circulation'' at line 1
 
Back
Top