ie i should have the ability to enter either a "Family","Phone" or "Rego" into the form and produce a list of customers which met the criteria and use family name as a link to retrive all booking made by that name. I am getting an error on line 50 at the moment which in my text editor is the </html> and </body> tag I will have to add validation as well and would also like some advice on how to achieve this ie Hyphens, Letters and Numbers for rego but length < 8 ie "TSA-909"
<?php
require_once("nocache.php"); // Stop information being cached
if (isset($_POST["submit"])) // Check form was submitted
{
$Family = $_POST["Family"];
$Phone = $_POST["Phone"];
$Rego = $_POST ["Vehicle_Rego"];
$conn = mysql_connect("localhost", "twastudent", "prac3"); mysql_select_db("autoservice", $conn); // Logins to Database // Connect to database
$sql = "SELECT familyName,contact,rego FROM customer,customerCar where customer.familyName = $Family ||customer.contact = '$Phone'|| customerCar.rego = $Rego";
$rs = mysql_query($sql, $conn) or die ('Problem with query' . mysql_error());
$recordcount = mysql_num_rows($rs);
?>
<html>
<head>
<title> Find Booking Form </title>
</head>
<body>
<form id = "CustomerBooking" method = "post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<label for = "Family"> Customer Family Name </label> <input type = "text" name = "Family" id = "Family"></input>
<label for = "Phone" > Customer Phone Number </label> <input type = "text" name = "Phone" id = "Phone"> </input>
<label for = "Vehicle_Rego" > Vehicle Registration Number </label> <input type = "text" name = "Vehicle_Rego" id = "Vehicle_Rego"></input>
<label for = "Submit">Submit </label> <input type = "submit" id = "Submit"> </input>
<label for = "reset" > Reset </label> <input type = "reset" id = "reset"> </input>
</form>
<?php
echo $recordcount;
if (mysql_num_rows($rs)> 0 )?>
<table>
<tr>
<th> Customer Family Name </th> <th> Customer First Name </th> <th> Customer Suburb </th> <th> Customer Phone</th> <th> Vehicle Registraion Number </th> <th> Date Of Service Booking </th>
</tr>
<td> <?php echo $row ["familyName"];?> </td>
<td> <?php echo $row ["contact"];?> </td>
<td> <?php echo $row ["rego"];?> </td>
</table>
</body> </html>
I am thinking that A regular expression may be needed as that is what i would do in javascript ie rechar8 [A-Z] [a-z][0-9] && length < 9 I know this is not written correctly there to explain the concept of what i am looking at doing
Any Help Is greatly Appreciated
This post has been edited by jaimesharp: 31 May 2011 - 03:26 AM

New Topic/Question
Reply




MultiQuote







|