Hi guys i have an assignment and it's asking me to let the user enter data into one of three text boxes to search for something in a database it also has to show the results in a table and be hyperlinked to the next page being bookingdetail.php and the page has to submit to itself. i have started although i cannot figure out what is wrong with my code. here it is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Aus AutoService - Find a Booking</title>
</head>
<body>
<?php
if(isset($_post["submit"])){
$familyname = $_POST('fName');
$phonenumber = $_POST('phNum');
$regno = $_POST('regNum');
$conn=mysql_connect("localhost","twastudent","prac3") or die(mysql_error());
mysql_select_db(autoservice, $conn) or die(mysql_error());
if(strlen($familyname) > 0 ){
$result1 = mysql_query("SELECT familyName, firstName, suburb, contact, rego, bookingDate FROM
customer, customerCar, booking WHERE familyName='$familyname' ORDER BY familyName, bookingDate");
}
else if(strlen($phonenumber) > 0 ){
$result2 = mysql_query("SELECT familyName, firstName, suburb, contact, rego, bookingDate FROM
customer, customerCar, booking WHERE contact='$phonenumber' ORDER BY familyName, bookingDate");
}
else if(strlen($regno) > 0 ){
$result3 = mysql_query("SELECT familyName, firstName, suburb, contact, rego, bookingDate FROM
customer, customerCar, booking WHERE booking.rego='$regno' ORDER BY familyName, bookingDate");
}
}
?>
<form id="findBooking" method="post" action="findbooking.php">
<p>Please enter the appropriate data into one of the three fields below:</p>
<table border="0">
<tr>
<td>Family Name</td>
<td>Phone Number</td>
<td>Vehicle Registration Number</td>
</tr>
<tr>
<td><input type="text" name="fName"/></td>
<td><input type="text" name="phNum"/></td>
<td><input type="text" name="regNum"/></td>
</tr>
</table>
<table>
<?php
while ($row = mysql_fetch_array($result1) { ?>
<tr>
<td><a href="BookingDetail.php=?familyname<?php echo $row["firstName"]?>"/></td>
<td><a href="BookingDetail.php=?familyname<?php echo $row["familyName"]?>"/></td>
<td><a href="BookingDetail.php=?familyname<?php echo $row["suburb"]?>"/></td>
<td><a href="BookingDetail.php=?familyname<?php echo $row["contact"]?>"/></td>
<td><a href="BookingDetail.php=?familyname<?php echo $row["rego"]?>"/></td>
<td><a href="BookingDetail.php=?familyname<?php echo $row["bookingDate"]?>"/></td>
</tr>
<?php }
mysql_close($conn); ?>
<?php
while ($row = mysql_fetch_array($result2) { ?>
<tr>
<td><a href="BookingDetail.php=?phonenumber<?php echo $row["firstName"]?>"/></td>
<td><a href="BookingDetail.php=?phonenumber<?php echo $row["familyName"]?>"/></td>
<td><a href="BookingDetail.php=?phonenumber<?php echo $row["suburb"]?>"/></td>
<td><a href="BookingDetail.php=?phonenumber<?php echo $row["contact"]?>"/></td>
<td><a href="BookingDetail.php=?phonenumber<?php echo $row["rego"]?>"/></td>
<td><a href="BookingDetail.php=?phonenumber<?php echo $row["bookingDate"]?>"/></td>
</tr>
<?php }
mysql_close($conn); ?>
<?php
while ($row = mysql_fetch_array($result3) { ?>
<tr>
<td><a href="BookingDetail.php=?regno<?php echo $row["firstName"]?>"/></td>
<td><a href="BookingDetail.php=?regno<?php echo $row["familyName"]?>"/></td>
<td><a href="BookingDetail.php=?regno<?php echo $row["suburb"]?>"/></td>
<td><a href="BookingDetail.php=?regno<?php echo $row["contact"]?>"/></td>
<td><a href="BookingDetail.php=?regno<?php echo $row["rego"]?>"/></td>
<td><a href="BookingDetail.php=?regno<?php echo $row["bookingDate"]?>"/></td>
</tr>
<?php }
mysql_close($conn); ?>
<input type="submit" value="log in" name="submit"/>
<input type="reset" />
</form>
</body>
</html>