Really wierd, it just won't update!! Its strange because, the form is validated using php which means that the variables must be present. For example if a description field is left empty it will display an error message. Here the sectuion of code:
if ($submit)
{
// Check GP number has been entered
if (empty($gp_no))
{
echo "<font color='#990000'>Error:</font> You have not entered your GP's Prescribing Number.<br>";
$stop = 1;
}
// Check to see if GP number is valid
elseif (($gp_no != 970920) &&($gp_no != 337088)&&($gp_no != 881133))
{
echo "<font color='#990000'>Error:</font> The GP's Prescribing Number you entered is not valid.<br>";
$stop = 1;
}
// Make sure collection place has been entered
if ($collect_place=='0')
{
echo "<font color='#990000'>Error:</font> You have not selected where you would like to collect your repeat perscription.<br>";
$stop = 1;
}
// Make sure collection date has been selected
if(($day == 0)or($month == 0)or($year == 0))
{
echo "<font color='#990000'>Error:</font> You have not entered a collection date.<br>";
$stop = 1;
}
// Collection date must allow 3 working days
$delivery_date = mktime (0,0,0,$month,$day,$year);
$three_days = mktime (0,0,0,date("m") ,date("d")+3,date("Y"));
if ($delivery_date >= $three_days)
{
// Do nothing...
}
else
{
echo "<font color='#990000'>Error:</font> You have not entered a collection date allowing three working days for processing.<br>";
$stop = 1;
}
// Make sure a request is made (starting in request fields 1)
if(empty($des_1)&&empty($quan_1))
{
echo "<font color='#990000'>Error:</font> You must request something by filling in the description and quantity fields making sure you start with request no 1.<br> ";
$stop = 1;
}
// Make sure quantity has been entered
if(empty($des_1)&&!empty($quan_1)OR empty($des_2)&&!empty($quan_2)OR empty($des_3)&&!empty($quan_3)OR empty($des_4)&&!empty($quan_4)OR empty($des_5)&&!empty($quan_5)OR empty($des_6)&&!empty($quan_6))
{
echo "<font color='#990000'>Error:</font> You must state a description if you enter a quantity.<br>";
$stop = 1;
}
// Make sure description has been entered
elseif(empty($quan_1)&&!empty($des_1)OR empty($quan_2)&&!empty($des_2)OR empty($quan_3)&&!empty($des_3)OR empty($quan_4)&&!empty($des_4)OR empty($quan_5)&&!empty($des_5)OR empty($quan_6)&&!empty($des_6))
{
echo "<font color='#990000'>Error:</font> You must state a quantity if you enter a description.<br>";
$stop = 1;
}
// Link back to request page
if ($stop)
{
echo "<p><a href='javascript:history.back()'>Return to previous page</a></p>";
}
// If all is filled out successfully get user to check all is right
if (!$stop)
{
$user_ip = $REMOTE_ADDR;
$sql_update = "update prescriptions set user_id='$user_id', des_1='$des_1', quan_1='$quan_1', des_2='$des_2', quan_2='$quan_2', des_3='$des_3', quan_3='$quan_3', des_4='$des_4', quan_4='$quan_4', des_5='$des_5', quan_5='$quan_5', des_6='$des_6', quan_6='$quan_6',collect_place='$collect_place', collect_when='$collect_when', rp_date='$rp_date', comments='$comments', rp_time='$rp_time', user_ip='$user_ip' where rp_id='$rp_id'";
$update = mysql_query ($sql_update);
print "<p>Your repeat prescription request has been successfully updated</p><a href='logout.php' target='_self'>Click here to logout</a>";
}
}