Currently this code lets me import the chosen mysql row in these text boxes.
I assumed from there it would just be a mater of declaring variables and then using the SET command to update. However While this application says the rows are updating, in relality there staying the same. I could swear the SQL code is fine, so I'm not sure whats wrong here.
Code: Select all
<?
if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
if (!isset($_POST["submit"]))
{
$bookingID = $_GET["bookingID"];
$sql = "SELECT * FROM booking WHERE bookingID=$bookingID";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form action="edit.php" method="post">
<input type=hidden name="bookingID" value="<?php echo $myrow["bookingID"] ?>">
Room Name:<INPUT TYPE="TEXT" NAME="roomName" VALUE="<?php echo $myrow["roomName"] ?>" SIZE=30><br>
Date:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["bookingDate"] ?>" SIZE=30><br>
Reason:<TEXTAREA NAME="reason" ROWS=10 COLS=30><?php echo $myrow["reason"] ?></TEXTAREA><br>
Start Time:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["startTime"] ?>" SIZE=5><br>
Finish Time:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["finishTime"] ?>" SIZE=5><br>
Lunch:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["lunch"] ?>" SIZE=3><br>
Tea:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["tea"] ?>" SIZE=3><br>
Room Type:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["roomType"] ?>" SIZE=40><br>
Campus:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["campus"] ?>" SIZE=11><br>
Attending:<INPUT TYPE="TEXT" NAME="lunch" VALUE="<?php echo $myrow["attending"] ?>" SIZE=3><br>
<input type="hidden" name="cmd" value="edit">
<input type="submit" name="submit" value="submit">
</form>
<? } ?>
<?
if ($_POST["submit"])
{
$bookingID = $_POST["bookingID"];
$roomName = $_POST["roomName"];
$bookingDate = $_POST["bookingDate"];
$reason = $_POST["reason"];
$startTime = $_POST["startTime"];
$finishTime = $_POST["finishTime"];
$lunch = $_POST["lunch"];
$tea = $_POST["tea"];
$roomType = $_POST["roomType"];
$campus = $_POST["campus"];
$attending = $_POST["attending"];
$sql = "UPDATE booking SET roomName='$roomName' ,bookingDate='$bookingDate' ,reason='$reason'"
. " ,startTime='$startTime' ,finishTime='$finishTime' ,lunch='$lunch' ,tea='$tea' ,roomType='$roomType'"
.",campus='$campus' ,attending='$attending' WHERE bookingID=$bookingID";
$result = mysql_query($sql);
echo "Thank you! Information updated.";
}
}
?>