The script won’t insert values into my database. it doesn’t give out any error messages. the page displays the info the user input into the form. im using the same connection variables as before so i don’t think there is anything wrong with them
[code=php]<?php
$Username = $_POST[‘Account_Username’];
$Password = $_POST[‘Account_Password’];
$ConfirmP = $_POST[‘Account_PasswordConfirm’];
$FullName = $_POST[‘Contact_FullName’];
$Address1 = $_POST[‘Contact_StreetAddress’];
$Address2 = $_POST[‘Contact_Address2’];
$City = $_POST[‘Contact_City’];
$Province = $_POST[‘Contact_Province’];
$Country = $_POST[‘Contact_Country’];
$Email = $_POST[‘Contact_Email’];
$self = $_SERVER[‘PHP_SELF’];
$referer = $_SERVER[‘HTTP_REFERER’];
if((!$Username) or (!$Password) or (!$ConfirmP) or (!$Email) or (!$FullName))
{
#if the fields required were empty then return to refernce page
header(“Location:$referer”);
exit();
if($Password == $ConfirmP)
{
#submit details into database if the passwords match
echo(“The passwords matched”);
#connect to MySQL
$conn = @mysql_connect(“#”, “#”,”#”)
or die(“Could not Connect”);
#select the specified database
$rs = @mysql_select_db(“lynchmc”, $conn)
or die(“Could not select specified”);
#create the sql query
$sql = “INSERT INTO users
(Username, Password, FullName, Address1, Address2, City, Province, Country, Email)
VALUES
(‘$Username’, PASSWORD(‘$Password’), ‘$FullName’, ‘$Address1’, ‘$Address2’, ‘$City’, ‘$Province’, ‘$Country’, ‘$Email’)”;
#execute the query
$res = mysql_query($sql, $conn)
or die (“Could not execute query: “.mysql_error());
if($res == true) {
echo (“Done”);
}
else
{
echo(“Didn’t work”);
}
}
else{
#send back to registration with all fields still there except passwords
header(“Location:$referer”);
exit();
}
}
?><html><head><title>Registration Page</title></head>
<body>
<hr>
<?
echo(“$Username<br>”);
echo(“$Password<br>”);
echo(“$ConfirmP<br>”);
echo(“$FullName<br>”);
echo(“$Address1<br>”);
echo(“$Address2<br>”);
echo(“$Province<br>”);
echo(“$Country<br>”);
echo(“$Email<br>”);
?>
</body></html>