谁能告诉我为什么我的数据不会插入到我的数据库中?连接信息很好。我究竟做错了什么?
<?php
error_reporting();
include('include/config.php');
$strMsg="Signup, It's Free!";
?>
<html>
<head>
<title>Try This Fecal Matter</title>
</head>
<body>
<?php
function validate($strMsg){
//Validation upon Submit Click
if(isset($_POST['submit'])){
//Validate First Name Field
if($_POST['fName']==""){
$strMsg="Please Enter Your First Name.";
showMForm($strMsg);
}
//Validate Last Name Field
elseif($_POST['lName']==""){
$strMsg="Please Enter Your Last Name.";
showMForm($strMsg);
}
//elseif for validation of Email with a Regular Expression
elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['eMail'])) {
$strMsg="Please Enter Your Email.";
showMForm($strMsg);
}
//Validate password
elseif($_POST['pWord1']==""){
$strMsg="Please Enter A Password.";
showMForm($strMsg);
}
elseif($_POST['pWord2']!=$_POST['pWord1']){
$strMsg="Your Passowrds Do Not Match.";
showMForm($strMsg);
}
else{
$fName=$_POST['fName'];
$lName=$_POST['lName'];
$eMail=$_POST['eMail'];
$pass=md5($_POST['pWord1']);
/*$SQL="SELECT eMail FROM users WHERE eMail = '".$eMail."'";
$rs = mysql_query($SQL);
echo $SQL;
if($rs && mysql_num_rows($rs)>0){
$strMsg="Email Already Registered";
showForm($strMsg);
}
else{
*/
//Send Content To Database..
// $SQL = "INSERT INTO 'users' (`userID`, `fName`, `lName`, `eMail`, `pass`)
VALUES (NULL,
dbConnect();
$SQL = "INSERT INTO users (`userID`, `fName`, `lName`, `eMail`, `pass`,
`bgPic`,`bio`) VALUES (NULL,'$fName', '$lName', '$eMail', '$pass', NULL, NULL );";
echo $fName."<br/>";
echo $lName."<br/>";
echo $eMail."<br/>";
echo $pass."<br/>";
// }
echo $SQL;
}
}
else
showMForm($strMsg);
}
function showMForm($strMsg){
echo"<div id=\"form\">\n";
echo"<h2>".$strMsg."</h2><br/>\n";
echo" <form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" >\n";
echo" <p>First Name:<br/>\n";
echo" <input type=\"text\" name=\"fName\" value=\"".$_POST['fName']."\"/></p>\n";
echo" <p>Last Name:<br/>\n";
echo" <input type=\"text\" name=\"lName\" value=\"".$_POST['lName']."\"/></p>\n";
echo" <p>E-mail:<br/>\n";
echo" <input type=\"text\" name=\"eMail\" value=\"".$_POST['eMail']."\"/></p>\n";
echo" <p>Passwod:<br/>\n";
echo" <input type=\"text\" name=\"pWord1\" value=\"\"/></p>\n";
echo" <p>Re-Enter Passwod:<br/>\n";
echo" <input type=\"text\" name=\"pWord2\" value=\"\"/></p>\n";
echo" <p>Regarding:<br/>\n";
echo" <select name=\"state\">\n";
echo" <option value=\"Ohio\">Ohio</option>\n";
echo" <option value=\"Michigan\">Michigan</option>\n";
echo" <option value=\"Indiana\">Indiana</option>\n";
echo" <option value=\"Pensylvania\">Pensylvania</option>\n";
echo" </select>\n";
echo" <p><input type=\"submit\" value=\"Submit\" class=\"btnSubmit\" name=\"submit\" /></p>\n";
echo" </form>\n";
}
validate($strMsg);
?>
</body>
</html>