I feel very silly, I have corrected the issue and you were right it was returning a null value as i wasnt running the first query to gather the results. Thankyou.
Are you able to assist me with another issue. I then want to submit this modified info into the database to update it. So the code for the text boxes to enter info is
echo '<table width="1500"><tr><td>';
$query="select * from meals where WD='$DayWeek' ";
$result=mysql_query($query);
echo mysql_error();
if ($result!="") {
while ($row=mysql_fetch_array($result)) {
echo '<p><h1>Change the '.$DayWeek.' menu</h1>';
echo '<form action="postrequest.php" method="post">';
echo '<p>Breakfast Title: <input type="text" name="btitle" value="'.$row['btitle'].'">';
echo '<p>Breakfast Option 1: <input type="text" name="bopt1" value="'.$row['bopt1'].'">';
echo '<p>Breakfast Option 2: <input type="text" name="bopt2" value="'.$row['bopt2'].'">';
echo '<p>Breakfast Option 3: <input type="text" name="bopt3" value="'.$row['bopt3'].'">';
echo '<p>Breakfast Option 4: <input type="text" name="bopt4" value="'.$row['bopt4'].'">';
echo '<p>Breakfast Option 5: <input type="text" name="bopt5" value="'.$row['bopt5'].'">';
echo '<p>Breakfast Desert: <input type="text" name="bdesert" value="'.$row['bdesert'].'">';
echo '<p>Lunch Title: <input type="text" name="ltitle" value="'.$row['ltitle'].'">';
echo '<p>Lunch Option 1: <input type="text" name="lopt1" value="'.$row['lopt1'].'">';
echo '<p>Lunch Option 2: <input type="text" name="lopt2" value="'.$row['lopt2'].'">';
echo '<p>Lunch Option 3: <input type="text" name="lopt3" value="'.$row['lopt3'].'">';
echo '<p>Lunch Option 4: <input type="text" name="lopt4" value="'.$row['lopt4'].'">';
echo '<p>Lunch Option 5: <input type="text" name="lopt5" value="'.$row['lopt5'].'">';
echo '<p>Lunch Option 6: <input type="text" name="lopt6" value="'.$row['lopt6'].'">';
echo '<p>Lunch Desert: <input type="text" name="ldesert" value="'.$row['ldesert'].'">';
echo '<p>Supper Title: <input type="text" name="stitle" value="'.$row['stitle'].'">';
echo '<p>Supper Option 1: <input type="text" name="sopt1" value="'.$row['sopt1'].'">';
echo '<p>Supper Option 2: <input type="text" name="sopt2" value="'.$row['sopt2'].'">';
echo '<p>Supper Option 3: <input type="text" name="sopt3" value="'.$row['sopt3'].'">';
echo '<p>Supper Option 4: <input type="text" name="sopt4" value="'.$row['sopt4'].'">';
echo '<p>Supper Option 5: <input type="text" name="sopt5" value="'.$row['sopt5'].'">';
echo '<p>Supper Option 6: <input type="text" name="sopt6" value="'.$row['sopt6'].'">';
echo '<p>Supper Desert: <input type="text" name="sdesert" value="'.$row['sdesert'].'">';
echo '<p><input type="submit" value="Submit">';
echo '</td>';
}
}
and then the post request is as follows
$server=mysql_connect($dbhostname,$dbusername,$dbpassword) or die ("Couldnt connect to server");
$db=mysql_select_db('menu',$server) or die ("Couldnt select DB");
$time=date("Y-m-d H:i:s");
$day=($_POST[day]);
$week=($_POST[week]);
$btitle=($_POST[btitle]);
$bopt1=($_POST[bopt1]);
$bopt2=($_POST[bopt2]);
$bopt3=($_POST[bopt3]);
$bopt4=($_POST[bopt4]);
$bopt5=($_POST[bopt5]);
$bdesert=($_POST[bdesert]);
$ltitle=($_POST[ltitle]);
$lopt1=($_POST[lopt1]);
$lopt2=($_POST[lopt2]);
$lopt3=($_POST[lopt3]);
$lopt4=($_POST[lopt4]);
$lopt5=($_POST[lopt5]);
$lopt6=($_POST[lopt6]);
$ldesert=($_POST[ldesert]);
$stitle=($_POST[stitle]);
$sopt1=($_POST[sopt1]);
$sopt2=($_POST[sopt2]);
$sopt3=($_POST[sopt3]);
$sopt4=($_POST[sopt4]);
$sopt5=($_POST[sopt5]);
$sopt6=($_POST[sopt6]);
$sdesert=($_POST[sdesert]);
$query="UPDATE meals SET btitle='$btitle', bopt1='$bopt1', bopt2='$bopt2', bopt3='$bopt3', bopt4='$bopt4', bopt5='$bopt5', bdesert='$bdesert', ltitle='$ltitle', lopt1='$lopt1', lopt2='$lopt2', lopt3='$lopt3', lopt4='$lopt4', lopt5='$lopt5', lopt6='$lopt6', ldesert'$ldesert', stitle='$stitle', sopt1='$sopt1', sopt2='$sopt2', sopt3='$sopt3', sopt4='$sopt4', sopt5='$sopt5', sopt6='$sopt6', sdesert='$sdesert' WHERE WD='$DayWeek'";
$result=mysql_query($query);
echo mysql_error();
The error I recieve is as follows
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 ''Freshly made Muffins, Warm Bakers Basket', stitle='ENGLISH NIGHT', sopt1='SWEDE' at line 1
Any ideas?