Code:
<?php if (isset($_get['submit'])) { $dy=$_get['days']; $pr=$_get['paper']; $tim=$_get['timing']; $con = mysql_connect("localhost","root",""); if($con){ echo("Connected Successfully"); mysql_select_db("datesheet", $con); }else{ echo("Connected Successfully"); } $sql ="INSERT INTO datesheet(Days,Paper,Timing) VALUES('$dy','$pr','$tim')"; $check=mysql_query($sql,$con); if($check){ echo("Data inserted successfully"); }else{ echo("their exist some problem"); } mysql_close($con); } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Std</title> </head> <body> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table border="1" width="170" align="center"> <tr> <td>Days</td> <td><input type="text" id="days"></td> </tr> <tr> <td>Paper</td><td><input type="text" id="paper"></td> </tr> <tr> <td>Timing</td><td><input type="text" id="timing"></td> </tr> <tr align="center"> <td colspan="2"><input type="submit" id="submit"></td> </tr> </table> </form> </body> </html>
Comment