Hi
I explain what I have: user will visit the site to change booking detail using their client and booking ID, once thy typed their ID they will be directed to another page where they will be welcomed and they will be presented with a form to enter the booking ID they need to change and type their new booking details.
My question is what is the if statement which only show the second part of the (Form) to the user only if they have typed correct client ID. i.e if there is no record of them they should get an error message saying that we don’t have a record for you please try again.
Hope I have managed to explain my question well. Below is the code which I am using in my page.
<html>
<head>
<title>change Booking Details</title>
</head>
<body>
<?php
// Have they entered a ClientID?
if(empty($_POST['clientID']))
{
die("Please enter your correct BookingID number.");
}
$con = mysql_connect("xxxxxxxx","xxxxxx","xxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxxxx", $con);
$result = mysql_query("SELECT * FROM clients WHERE clientID=$_POST[clientID]");
// if statment should start here
// if statment should here
while($row = mysql_fetch_array($result))
{
print "Hi";
echo(" ");
echo $row['firstname'] . " " . $row['surname'];
echo(" ");
echo("welcome back you can change your booking using the form below ");
echo "<br />";
}
mysql_close($con)
?>
<p> hi </p>
<form name="form1" method="post" action="../actions/booking_updated.php">
<table width="75%" border="1">
<tr>
<td>Bookin ID</td>
<td><input type="text" name="bookingID"></td>
</tr>
<tr>
<td width="34%">Arrival Date</td>
<td width="66%"> <input name="startdate" type="text" id="startdate" maxlength="10">
(yyyy-mm-dd) </td>
</tr>
<tr>
<td>Departure Date</td>
<td><input name="enddate" type="text" id="enddate" maxlength="10">
(yyyy-mm-dd) </td>
</tr>
<tr>
<td>Room Type</td>
<td><select name="roomtype" id="roomtype">
<option value="Single">Single</option>
<option value="Double">Double</option>
<option value="Suite" selected>Suite</option>
</select></td>
</tr>
<tr>
<td>Number of Adults:</td>
<td><select name="adults" id="adults">
<option value="1">1</option>
<option value="2">2</option>
</select></td>
</tr>
<tr>
<td>Number of Children:</td>
<td><select name="children" id="children">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select></td>
</tr>
<tr>
<td>Special Requirments</td>
<td><textarea name="requirements" cols="30" id="requirements"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="updatebooking" type="submit" id="updatebooking" value="Update Booking"></td>
</tr>
</table>
<p> </p>
</form>
<p> </p>
</body>
</html>