Returning customer information autofill?

OK, been working on this for a while, but I’m now stuck. I’ve got a mysql database set up for customer orders and I want to set it up to be able to pull up customer information based on first and last name, apply it to the form, and allow the user to finish filling out the order.

Here’s what I have:

<?php if (isset($_POST['submit'])) { //WHAT HAPPENS WHEN FORM IS SUBMITTED } if (isset($_POST['find'])) { mysql_connect("....", "....", "....") or die(mysql_error()); mysql_select_db("...") or die(mysql_error());

$fname = $_POST[‘fname’];
$lname = $_POST[‘lname’];

$user = mysql_query(“SELECT * FROM customer WHERE FirstName=’$fname’ AND LastName=’$lname’”) or die(mysql_error());
$isuser = mysql_num_rows($user);
if ($isuser == 0) {
}
else
{
$address1 = mysql_result($user,0,“AddressLn1”);
$address2 = mysql_result($user,0,“AddressLn2”);
$city = mysql_result($user,0,“City”);
$state = mysql_result($user,0,“State”);
$zip = mysql_result($user,0,“ZIPCode”);
$phone1 = mysql_result($user,0,“Phone1”);
$phone2 = mysql_result($user,0,“Phone2”);
$ip = mysql_result($user,0,“CustIP”);

}
mysql_close();
}
?>

\\.... ETC ....
Customer
Address Item Description
Model Number

At this point all I really want it to do is to pick those variables and place it in the form on “FIND”, but it returns to a blank screen. Any Ideas??

Any suggestions are welcome.

OK, figured it out, seems that the mysql_close(); statement has to appear after the table in the body tag :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service