php - Everything is ok but the registration is not working -


i trying build social network portal. wrote code. after submiting registration data redirecting me successfull registration page not registering users on database. if email address , confirm email address did not match showing registration successfull.

config.php

<?php define("host","localhost"); define("db","thinker"); define("dbuser","root"); define("dbpass",""); ?> 

connection.php

<?php include("config.php"); $connection=mysqli_connect(host,dbuser,dbpass,db); if(mysqli_connect_errno($connection)){     echo "failed connect mysql database: ".mysqli_connect_error(); } ?> 

index.html

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/welcome.css"/> <title>welcome thinkers</title> </head> <body> <div class="header"><div class="logo">welcome thinkers</div> </div> <div class="reg"><p class="pfrom">register here</p><br/> <form action="../thinkers/registration/registration.php" method="post" enctype="multipart/form-data" name="maskname" class="regform"> mask name     : <input type="text" name="maskname" /><br/> user name     : <input type="text" name="maskname" /><br/> first name    : <input type="text" name="maskname" /><br/> last name     : <input type="text" name="maskname" /><br/> birthday      : <input type="text" name="maskname" /><br/> email address : <input type="text" name="maskname" /><br/> confirm e-add : <input type="text" name="maskname" /><br/> password      : <input type="text" name="password" /><br/> confirm password :<input type="text" name="confirmpassword" /><br/> <input type="submit" value="click here register" /> </form> </div> <div class="footer"> <h1>this footer</h1> </div> </body> </html> 

registration.php

<?php require("connection.php"); if(isset ($_post["maskname"],$_post["username"],$_post["firstname"],$_post["lastname"],$_post["dateofbirth"],$_post["emailaddress"],$_post["confirmemailaddress"],$_post["password"],$_post["confirmpassword"])){     $maskname=$_post["maskname"];     $username=$_post["username"];     $firstname=$_post["firstname"];     $lastname=$_post["lastname"];     $dateofbirth=$_post["dateofbirth"];     $emailaddress=$_post["maskname"];     $confirmemailaddress=$_post["confirmemailaddress"];     $password=$_post["password"];     $confirmpassword=$_post["confirmpassword"];  } if($emailaddress!=$confirmemailaddress|| $password!=$confirmpassword){     echo "email address , password did not match"; } else{$sql="insert member (maskname, username, firstname,lastname, emailaddress, password,birthday) values ('$maskname', '$username', '$firstname','$lastname', '$emailaddress', '$password','$birthday')" && header('location: ../registration/successfull.html'); } if(!mysqli_query($connection,$sql)){     die('error: ' . mysqli_error($connection)); } mysqli_close($connection); ?> 

successfull.html

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="../css/welcome.css"/> <title>registration successfull</title> </head> <body> <div class="header"><div class="logo">welcome thinkers</div> </div> <div class="reg"><p class="pfrom">you have been registered successfully</p><br/> <form action="login.php" method="post" enctype="multipart/form-data" name="maskname" class="regform"> email address<br/> <input type="text" name="emailaddress" /><br/> password<br/> <input type="password" name="password" /><br/><br/> <input type="submit" value="click enter world" /> </form> <div class="footer"> <h1>this footer</h1> </div> </div> 

edited html form code

<div class="reg"><p class="pfrom">register here</p><br/> <form action="../thinkers/registration/registration.php" method="post" enctype="multipart/form-data" class="regform"> mask name     :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="maskname" /><br/> user name     :&nbsp; &nbsp; &nbsp;  &nbsp; <input type="text" name="username" /><br/> first name    :&nbsp; &nbsp; &nbsp; &nbsp; <input type="text" name="firstname" /><br/> last name     :&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <input type="text" name="lastname" /><br/> birthday      :&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="text" name="birthday" /><br/> email address :&nbsp; &nbsp; <input type="text" name="emailaddress" /><br/> confirm e-add :&nbsp;&nbsp; <input type="text" name="confiremailaddress" /><br/> password :&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="password" /><br/> confirm password :<input type="text" name="confirmpassword" /><br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;  &nbsp;<input type="submit" value="click here register" /> </form> 

edited php code

    <?php require("connection.php"); if(isset ($_post["maskname"],$_post["username"],$_post["firstname"],$_post["lastname"],$_post["dateofbirth"],$_post["emailaddress"],$_post["confirmemailaddress"],$_post["password"],$_post["confirmpassword"])){     $maskname=$_post["maskname"];     $username=$_post["username"];     $firstname=$_post["firstname"];     $lastname=$_post["lastname"];     $dateofbirth=$_post["dateofbirth"];     $emailaddress=$_post["maskname"];     $confirmemailaddress=$_post["confirmemailaddress"];     $password=$_post["password"];     $confirmpassword=$_post["confirmpassword"];  } if($emailaddress!=$confirmemailaddress or $password!=$confirmpassword){     echo "email address , password did not match"; } else{$sql="insert member (maskname, username, firstname,lastname, emailaddress, password,birthday) values ('$maskname', '$username', '$firstname','$lastname', '$emailaddress', '$password','$birthday')";   } if(!mysqli_query($connection,$sql)){     die('error: ' . mysqli_error($connection)); } mysqli_close($connection); ?> 

in index.html form should this

    <form action="../thinkers/registration/registration.php" method="post" name="maskname" class="regform">     mask name     : <input type="text" name="maskname" /><br/>     user name     : <input type="text" name="username" /><br/>     first name    : <input type="text" name="firstname" /><br/>     last name     : <input type="text" name="lastname" /><br/>     birthday      : <input type="text" name="dateofbirth" /><br/>     email address : <input type="text" name="emailaddress" /><br/>     confirm e-add : <input type="text" name="confirmemailaddress" /><br/>     password      : <input type="text" name="password" /><br/>     confirm password : <input type="text" name="confirmpassword" /><br/>     <input type="submit" value="click here register" /> 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -