1.Make a File header.php with the Code
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","roo t","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("college", $con);
$sql="INSERT INTO student (name, rollno, class)
VALUES
('$_POST[name]','$_POST[rollno ]','$_POST[class]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>
</body>
</html>
2. Create a File table.php with the code:
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form action="header.php" method="post">
name: <input type="text" name="name" />
class: <input type="text" name="class" />
rollno: <input type="text" name="rollno" />
<input type="submit" />
</form>
</body>
</html>
3.Create Database in Server:
Database name: table
table name : student
column name:name,class,rollno
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","roo
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("college", $con);
$sql="INSERT INTO student (name, rollno, class)
VALUES
('$_POST[name]','$_POST[rollno
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>
</body>
</html>
2. Create a File table.php with the code:
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form action="header.php" method="post">
name: <input type="text" name="name" />
class: <input type="text" name="class" />
rollno: <input type="text" name="rollno" />
<input type="submit" />
</form>
</body>
</html>
3.Create Database in Server:
Database name: table
table name : student
column name:name,class,rollno


No comments:
Post a Comment