html - Php form does not post all fields to MySql -
i checked answers under ( php form not posting fields 2 ) , have names in form fields : .... however, posting id, date, , name... confused.
here sign-up -html- :
<legend>registration form</legend><p></p> <label> name </label> <input id="intext" type="text" name="name" /><p></p> <label> email </label> <input id="intext" type="text" name="email" /><p></p> <label> zip_code </label> <input id="intext" type="text" name="zipcode" /><p></p> <label> username </label> <input id="intext" type="text" name="user" /><p></p> <label> password </label> <input type="password" name="pass" /><p></p> <label> confirm password </label> <input type="password" name="cpass" /><p> </p> <div class="center">comments / inquiry </div> <div class="center"> <textarea id="textarea" name="comments" rows="10" cols="40"></textarea>
here php function:
function newuser() { $name = $_post['name']; $name = $_post['name']; $email = $_post['email']; $zip_code = $_post['zipcode']; $username = $_post['user']; $password = $_post['pass']; $comments = $_post['comments']; $query = "insert websiteusers (name, email, zip_code, username, password, comments) values ('$name','$email','$zipcode','$user','$pass','$comments')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo "thank registering us."; } } function signup() { if(!empty($_post['user'])) //checking 'user' name sign-up.html, empty or have text { $query = mysql_query("select * websiteusers username = '$_post[user]' , password = '$_post[pass]'") or die(mysql_error()); if(!$row = mysql_fetch_array($query) or die(mysql_error())) { newuser(); }
in query usign variables in lowercase in variable declarations uppercase.
can try code?
$query = "insert websiteusers (name, email, zip_code, username, password, comments) values ('$name','$email','$zipcode','$user','$pass','$comments')";
Comments
Post a Comment