Php code for validating registration form


22-Jan-2015 18:16

Lets see create the registration form in PHP , Mysql, HTML.Create database db_name ie, Create database new where new is my database name Then you've to use below Mysql query for use created database.

php code for validating registration form-10

Adult sex chat with robots

Use db_name ie, Use new After finished database and table creation, you need to create front end design which can be viewed by users. Using below HTML code to create registration form in HTML.

After created form in HTML, it should not be present user attractable one.

$name=$_POST['name']; $password=$_POST['password']; $mail=$_POST['mail']; $q=mysql_query("select * from login where name='".$name."' or mail='".$mail."' ") or die(mysql_error()); $n=mysql_fetch_row($q); if($n0) { $er='The username name '.$name.' or mail '.$mail.' is already present in our database'; } else { $insert=mysql_query("insert into login values('".$name."','".$password."','".$mail."')") or die(mysql_error()); if($insert) { $er='Values are registered successfully'; } else { $er='Values are not registered'; } } body { color:white; font-size:14px; } .contact { text-align:center; background: none repeat scroll 0% 0% #8FBF73; padding: 20px 10px; box-shadow: 1px 2px 1px #8FBF73; border-radius: 10px; width:520px; } #name, #password, #mail { width: 250px; margin-bottom: 15px; background: none repeat scroll 0% 0% #AFCF9C; border: 1px solid #91B57C; height: 30px; color: #808080; border-radius: 8px; box-shadow: 1px 2px 3px; } #submit { background:none repeat scroll 0% 0% #8FCB73; display: inline-block; padding: 5px 10px; line-height: 1.05em; 0) { $er='The username name '.$name.' or mail '.$mail.' is already present in our database'; } else { $insert=mysql_query("insert into login values('".$name."','".$password."','".$mail."')") or die(mysql_error()); if($insert) { $er='Values are registered successfully'; } else { $er='Values are not registered'; } } } ?

$(document).ready(function() { $('#submit').click(function() { var name=Element By Id('name').value; var password=Element By Id('password').value; var mail=Element By Id('mail').value; var chk = /^([\w-\.][email protected]([\w-]+\.)+[\w-]{2,4})?

chk.test(mail)) { $('#er').html('Enter valid email'); return false; } }); }); Then you need to write server side script to store values into database.

First you make connection to Mysql database to store user values using PHP. Add below PHP codes Here is the PHP code for insert user data into Mysql database.