Php MySql Connection


<?php
if(isset($_POST[‘btnSave’]))  //isset checked button Sent True or Null
{
$A = $_POST[‘txtName’];
$B = $_POST[‘txtPhone’];
$C = $_POST[‘txtEmail’];
$D = $_POST[‘txtNIC’];
//————————-//
$CN = mysql_connect(“LocalHost”,”root”,””);
mysql_select_db(“AirLineDB”,$CN);  //AirLineDB is Database name
mysql_query(“Insert into tblStudent values (”,’$A’,’$B’,’$C’,’$D’)”,$CN);  //tblStudent is Table Name
mysql_close($CN);
echo “Data Saved…”;

}
?>
<html>
<body>
<h2 align=center>Enter Student Information</h2>
<form action=”Register.php” Method=”POST”>
<table border=1 cellPadding=5 cellSpacing=5 align=center>
<tr>
<td bgcolor=aqua>Name</td>
<td><input type=Text name=txtName Required></td>
</tr>
<tr>
<td bgcolor=aqua>Phone</td>
<td><input type=Text name=txtPhone Required></td>
</tr>
<tr>
<td bgcolor=aqua>Email</td>
<td><input type=Text name=txtEmail Required></td>
</tr>
<tr>
<td bgcolor=aqua>N-I-C</td>
<td><input type=Text name=txtNIC Required></td>
</tr>
<tr>
<td bgcolor=aqua>.</td>
<td><input type=Submit name=btnSave Value=Save></td>
</tr>
</table>
</form>
</body>
</html>

Advertisements

It's Great To Hear From You

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s