Chris13
11-28-2006, 07:57 PM
This code does not submit anything to database neither does it show me any error. Just a blank page. Also not sure what does this line if ($_POST['submit']) supposed to carry. Please advice.
if ($_POST['submit']) {
// connect and select the database
$conn = mysql_connect($host, $user, $password) or die(mysql_error());
$db = mysql_select_db($dbName, $conn) or die(mysql_error());
// insert new entry in the database if entry submitted
$fName = $_POST['fName'];
$lName = $_POSR['lName'];
$email = $_POST['email'];
$confEmail = $_POST['confEmail'];
$password = $_POST['password'];
$confirmPassword = $_POST['confirmPassword'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$postCode = $_POST['postCode'];
$gender = $_POST['gender'];
$profession = $_POST['profession'];
$ageGroup = $_POST['ageGroup'];
$mallPref = $_POST['mallPref'];
$mailConsent = $_POST['mailConsent'];
// insert new entry into database
$sql = "insert data `userdata` (`fName`, `lName`, `email`, `confEmail`, `password`, `confirmPassword`, `address`, `city`, `state`, `postCode`, `gender`, `profession`, `ageGroup`, `mallPref`, `mailConsent`) VALUES ('$fName', '$lName', '$email', '$confEmail', '$password', '$confirmPassword', '$address', '$city', '$state', '$postCode', '$gender', '$profession', '$ageGroup', '$mallPref', '$mailConsent')";
if(mysql_query($sql))
echo("Values inserted successfully");
else
die("Error! Could not insert values".mysql_error());
} // end if new entry posted
?>
Thanks in advance.
Chris
if ($_POST['submit']) {
// connect and select the database
$conn = mysql_connect($host, $user, $password) or die(mysql_error());
$db = mysql_select_db($dbName, $conn) or die(mysql_error());
// insert new entry in the database if entry submitted
$fName = $_POST['fName'];
$lName = $_POSR['lName'];
$email = $_POST['email'];
$confEmail = $_POST['confEmail'];
$password = $_POST['password'];
$confirmPassword = $_POST['confirmPassword'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$postCode = $_POST['postCode'];
$gender = $_POST['gender'];
$profession = $_POST['profession'];
$ageGroup = $_POST['ageGroup'];
$mallPref = $_POST['mallPref'];
$mailConsent = $_POST['mailConsent'];
// insert new entry into database
$sql = "insert data `userdata` (`fName`, `lName`, `email`, `confEmail`, `password`, `confirmPassword`, `address`, `city`, `state`, `postCode`, `gender`, `profession`, `ageGroup`, `mallPref`, `mailConsent`) VALUES ('$fName', '$lName', '$email', '$confEmail', '$password', '$confirmPassword', '$address', '$city', '$state', '$postCode', '$gender', '$profession', '$ageGroup', '$mallPref', '$mailConsent')";
if(mysql_query($sql))
echo("Values inserted successfully");
else
die("Error! Could not insert values".mysql_error());
} // end if new entry posted
?>
Thanks in advance.
Chris