Create Simple Form Using php

Create Simple Form Using Php with backend With all types of input :

Code:

 <!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" />  
 <title>Php Form Demo</title>  
 </head>  
 <body>  
 <form method="post" action="insert.php">  
 <font size="+1">  
 <fieldset>  
 <legend>Personal Information</legend>  
 <p>  
 firstname * <input type="text" name="fname" required />  
 <br/><br/>  
 lastname:  
 <input type="text" name="lname" />  
 <br/><br/>  
 Date of birth:  
 <input type="date" name="dob" value="2018-07-22"  
         min="2000-01-01" max="2018-12-31"/>  
 <br/><br/>  
 organization:  
 <input type="text" name="org" />  
 <br/>  
 <br/>  
 designation:  
 <input type="text" name="dst" />  
 <br/>  
 <br/>  
 country:  
 <select name="country">  
 <?php  
 $con=mysql_connect("localhost","root","");  
 mysql_select_db("exam");  
 $q1=mysql_query("select * from tbllocations");  
 while($r1=mysql_fetch_array($q1))  
 {  
      echo "<option value='".$r1['id']."'>".$r1['name']."</option>";  
 }  
 ?>  
 </select>  
 <br/>  
 <br/>  
 state:  
 <input type="text" name="state" />  
 <br/>  
 <br/>  
 city:  
 <input type="text" name="city" />  
 <br/><br/>  
 <input type="submit" value="save" />  
 <input type="reset" value="cancel" />  
 </fieldset>  
 </p>  
 </font>  
 </form>  
 </body>  
 </html>  

Country table in database(tbllocations):-



OutPut:  



For more Query Please Comment...

Comments