Vintage
Row Making
antique, vintage,
and collectable treasures available to you!
\n";
}
$lname = trim($_REQUEST["lname"]);
if ($lname == "") {
$error .= "Please enter your last name. \n";
}
$zip = trim($_REQUEST["zip"]);
if ($zip != strval(intval($zip)) or $zip < 0) {
$error .= "Please enter a valid zip. \n";
}
return $error;
}
// Process the data
function processData() {
// Process the verified data here.
// This is where you save data in the database.
require "includes/dbconvars.php";
$dbCnx = mysql_connect($dbhost, $dbuser, $dbpwd)
or die(mysql_error());
mysql_select_db($dbname, $dbCnx)
or die(mysql_error());
// Process the first query
$street = trim($_REQUEST["street"]);
$city = trim($_REQUEST["city"]);
$state = trim($_REQUEST["state"]);
$zip = trim($_REQUEST["zip"]);
$sql = "
INSERT INTO addresses(Address, City, State, Zip)
VALUES ('$street', '$city', '$state', '$zip')
";
mysql_query($sql)
or die("Query failed: ".mysql_error());
$addressID = mysql_insert_id();
// Process the second query
$fname = trim($_REQUEST["fname"]);
$lname = trim($_REQUEST["lname"]);
$sql = "
INSERT INTO customers(LName, FName, AddressID)
VALUES ('$lname', '$fname', $addressID)
";
mysql_query($sql)
or die("Query failed: ".mysql_error());
mysql_close($dbCnx);
}
// Display the content of the page
function showContent($title, $errors) {
echo "
$title
\n"; if ($errors) {
echo "$errors\n";
}
// Put HTML after the closing PHP tag
?>