Bare with me, I've VERY new to PHP and any type of programing. I've created a form and then want the form to process the information into a database which I created in phpMyAdmin using WAMPSERVER.
When I test it, it echos exactly what it should, but at the end it tells me Insert Failed:
Customer Name: John Doe
Phone Number: 123-123-1234
Account Number: 84574738
Your information has been received and processed....Thank You!Insert Failed!!
When I check my database, it tells me MYSQL returned an empty result set. (duh...insert failed) Any ways, I can not figure out for the life of me what is wrong.
Here is my php file, can some one please help me...Like I said I really don't know anything about this stuff, someone helped me write this and now they're not available.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[
www.w3.org];
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CUSTOMER FORM</title>
</head>
<body>
<?php
$customername = $_REQUEST["customer_name"];
$phonenumber = $_REQUEST["phone_number"];
$acctnumber = $_REQUEST["acct_number"];
$address = $_REQUEST["address"];
$city = $_REQUEST["city"];
$state = $_REQUEST["state"];
$zip = $_REQUEST["zip"];
$inter = $_REQUEST["inter_lata"];
$intra = $_REQUEST["intra_lata"];
$servicerep = $_REQUEST["service_rep"];
echo("Customer Name: " . $customername . "<br>"
;
echo("Phone Number: " . $phonenumber . "<br>"
;
echo("Account Number: " . $acctnumber . "<br>"
;
echo("Your information has been received and processed....Thank You!"
;
$db = mysql_connect("localhost", "root", ""
or die("Could Not Connect!"
;
mysql_select_db("longdistance",$db) or die("Could Not Select Database!"
;
$sql = "insert into mail_list (customer_name, phone_number, acct_number, address, city, state, zip, inter_lata, intra_lata, service_rep)";
$sql = $sql . " values ('" . $customername . "','" . $phonenumber . "','" . $acctnumber . "','" . $address . "','" . $city . "','" . $state . "','" . $zip . "','" . $inter . "','" . $intra . "','" . $servicerep . "')";
mysql_query($sql, $db) or die("Insert Failed!!"
;
?>
</body>
</html>