*---Full registration form using MysQl insert data ----*
<?php
mysql_connect("localhost","root","");
mysql_select_db("exam");
if (isset($_POST["submit"])){
$name = $_POST['n1'];
$lastname = $_POST['n2'];
$father = $_POST['n3'];
$email = $_POST['n4'];
$password = $_POST['n5'];
$phone= $_POST['n6'];
$gender = $_POST['n7'];
$address = $_POST['n8'];
$nationality = $_POST['n9'];
$country = $_POST['n10'];
if(isset($_POST['n9'])){
$nationality = $_POST['n9'];
}
else{
$nationality = "";
}
$q = " insert into result(name,lastname,father,email,password,phone,gender,address,nationality,country) values ('$name','$lastname','$father','$email','$password','$phone','$gender','$address','$nationality','$country')";
$rs = mysql_query($q);
echo"submmite sussfully";
}
?>
<body>
<form method="post"><pre>
name<input type="text" name="n1" /><br />
last name<input type="text" name="n2" /><br />
father's name<input type="text" name="n3" /><br />
email<input type="email" name="n4" /><br />
password<input type="password" name="n5" /><br />
phone<input type="number" name="n6" /><br />
gender<input type="radio" name="n7" value="m"/>M<input type="radio" name="n7" value="f"/>F<br />
address<input type="text" name="n8" /><br />
nationality<input type="checkbox" name="n9" value ="india"/>Iinian<input type="checkbox" name="n9" value="other"/>Other<br />
country<select name="n10">
<option value="india">india</option>
<option value="nepal">nepal</option>
<option value="america">america</option>
<option value="other">other</option>
</select>
<br />
<input type="submit" name="submit" value="submit"/>
</form></pre>
</body>
<?php
mysql_connect("localhost","root","");
mysql_select_db("exam");
if (isset($_POST["submit"])){
$name = $_POST['n1'];
$lastname = $_POST['n2'];
$father = $_POST['n3'];
$email = $_POST['n4'];
$password = $_POST['n5'];
$phone= $_POST['n6'];
$gender = $_POST['n7'];
$address = $_POST['n8'];
$nationality = $_POST['n9'];
$country = $_POST['n10'];
if(isset($_POST['n9'])){
$nationality = $_POST['n9'];
}
else{
$nationality = "";
}
$q = " insert into result(name,lastname,father,email,password,phone,gender,address,nationality,country) values ('$name','$lastname','$father','$email','$password','$phone','$gender','$address','$nationality','$country')";
$rs = mysql_query($q);
echo"submmite sussfully";
}
?>
<body>
<form method="post"><pre>
name<input type="text" name="n1" /><br />
last name<input type="text" name="n2" /><br />
father's name<input type="text" name="n3" /><br />
email<input type="email" name="n4" /><br />
password<input type="password" name="n5" /><br />
phone<input type="number" name="n6" /><br />
gender<input type="radio" name="n7" value="m"/>M<input type="radio" name="n7" value="f"/>F<br />
address<input type="text" name="n8" /><br />
nationality<input type="checkbox" name="n9" value ="india"/>Iinian<input type="checkbox" name="n9" value="other"/>Other<br />
country<select name="n10">
<option value="india">india</option>
<option value="nepal">nepal</option>
<option value="america">america</option>
<option value="other">other</option>
</select>
<br />
<input type="submit" name="submit" value="submit"/>
</form></pre>
</body>
No comments:
Post a Comment