0% found this document useful (0 votes)
1 views8 pages

inputdata

The document contains PHP scripts and HTML forms for creating a database and inserting contact and student information into it. It includes forms for user input of personal and academic details, along with PHP code to handle database connections and execute SQL queries. The scripts demonstrate basic CRUD operations using MySQL, although they utilize deprecated MySQL functions.

Uploaded by

abhimanyu thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views8 pages

inputdata

The document contains PHP scripts and HTML forms for creating a database and inserting contact and student information into it. It includes forms for user input of personal and academic details, along with PHP code to handle database connections and execute SQL queries. The scripts demonstrate basic CRUD operations using MySQL, although they utilize deprecated MySQL functions.

Uploaded by

abhimanyu thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

Entry.

html
<form action=“entry.php" method="post">
First Name: <input type="text"
name="first"><br>
Last Name: <input type="text"
name="last"><br>
Phone: <input type="text"
name="phone"><br>
Mobile: <input type="text"
name="mobile"><br>
Fax: <input type="text" name="fax"><br>
E-mail: <input type="text"
name="email"><br>
<?php
$username="sanjay"; Entry.php
$password="sanjay";
$database="sanjay";
$first=$_POST['first'];
$last=$_POST['last'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select
database");

$query = "INSERT INTO contacts VALUES


('','$first','$last','$phone','$mobile','$fax','$email','$web')";
mysql_query($query);
mysql_close();
Databasecreate.php
<html><head><title>Create Database</title></head>
<body>
<?
$link = mysql_connect("localhost");
if (! $link)
die("Couldn't connect to MySQL");
//create database
mysql_create_db("mydatabase1")or die("Create Error:
".mysql_error());
mysql_close($link);
?>
</body>
</html>
tablecreate.php PAGE
– 1/2
<html><head><title>Create
Table</title></head>
<body>
<?
$db="mydatabase1";
$link = mysql_connect("localhost");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Select DB Error: ".mysql_error());
tablecreate.php PAGE
– 2/2
//create table
mysql_query("CREATE TABLE birthdays( id
INT NOT NULL AUTO_INCREMENT, PRIMARY
KEY(id), name VARCHAR(30), birthday
VARCHAR(7))")or die("Create table Error:
".mysql_error());
mysql_close($link);

?>
</body>
</html>
student.html
<form action="stu_entry.php"
method="post">
Name: <input type="text"
name="first"><br>
Branch: <input type="text"
name="branch"><br>
Theory Marks: <input type="text"
name="theory"><br>
Practical: <input type="text"
name="practical"><br>
Sex: <input type="text"
name="sex"><br>
<input type="Submit">
<?php Stu_entry.php PAGE –
1/2
$username="sanjay";
$password="sanjay";
$database="Student";
$first=$_POST['first'];
$branch=$_POST['branch'];
$theory=$_POST['theory'];
$practical=$_POST['practical'];
$sex=$_POST['sex'];
mysql_connect(localhost,$username,
$password);
@mysql_select_db($database) or die( "Unable
Stu_entry.php PAGE –
2/2
$query = "INSERT INTO marks VALUES
('$first','$branch','$theory','$practical','$sex
','')";
mysql_query($query);
mysql_close();
echo " Record Inserted";
?>

You might also like