First of all create database of your choice name and then create table named student with the following fields in MYSQL :
NO INT 3 PK
NAME VARCHAR 34
CITY VARCHAR 34
Then create HTML design as follows
insstud.html
<html>
<head>
</head>
<body>
<form action=stud.php method=GET>
No<input type=text name=sno><br>
Name<input type=text name=nm><br>
City<input type=text name=ct><br>
<input type=submit value=INSERT>
</form>
</body>
</html>
stud.php
<?php
$sno=$_GET['sno'];
$nm=$_GET['nm'];
$ct=$_GET['ct'];
$cn=mysql_connect("localhost","root") or die(mysql_error());
$db=mysql_select_db("student",$cn);
mysql_query("insert into stud values($sno,'$nm','$ct')",$cn) or die(mysql_error());
echo "Record successfully inserted."
?>
Then execute the program in the browser.....
Important note:
This program is without validation and will be checked according to the fields and data types in database.....
NO INT 3 PK
NAME VARCHAR 34
CITY VARCHAR 34
Then create HTML design as follows
insstud.html
<html>
<head>
</head>
<body>
<form action=stud.php method=GET>
No<input type=text name=sno><br>
Name<input type=text name=nm><br>
City<input type=text name=ct><br>
<input type=submit value=INSERT>
</form>
</body>
</html>
stud.php
<?php
$sno=$_GET['sno'];
$nm=$_GET['nm'];
$ct=$_GET['ct'];
$cn=mysql_connect("localhost","root") or die(mysql_error());
$db=mysql_select_db("student",$cn);
mysql_query("insert into stud values($sno,'$nm','$ct')",$cn) or die(mysql_error());
echo "Record successfully inserted."
?>
Then execute the program in the browser.....
Important note:
This program is without validation and will be checked according to the fields and data types in database.....
No comments:
Post a Comment