Hi
This code doesn't seem to be updating the database record.
What I am trying to achieve is user enters their password and selects a length value from the drop down list. Then clicks submit and the lenght value is updated against their password (which is a unique id in the database).
The page refreshes but nothing is updated in the database.
Any advice greatly appreciated!
Thanks
<?php
require_once ('mysql_connect.php');
if (isset ($_POST['submit'])) {
$query = "UPDATE table SET length='{$_POST['length']}' WHERE id={$_POST['id']}";
$r = mysql_query ($query);
$link='page.php';
echo "<script language=\"javascript\">window.location.href = '$link';</script>";
} else {
print '<form action="page.php" method="POST">
password:<br />
<input type="text" name="id" value="" /><br />
length:<br />
<SELECT NAME="pepperlength">
<OPTION VALUE="0" SELECTED>0 cm</OPTION>
<OPTION VALUE="1">1 cm</OPTION>
<OPTION VALUE="2">2 cm</OPTION>
<OPTION VALUE="3">3 cm</OPTION>
<OPTION VALUE="4">4 cm</OPTION>
<OPTION VALUE="5">5 cm</OPTION>
<OPTION VALUE="6">6 cm</OPTION>
</SELECT>
<input type="submit" name="submit" value="save changes" /></p>
</form>';
}
?>