Registration form in php


<html>

<head>


<title>test</title>

</head>

<body>

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" >

<table width="400" border="1">

<tr>

<td>name</td>

<td><input type="text" name="user"/> </td>

</tr>

<tr>

<td>address</td>

<td><input type="text" name="address" /></td>

</tr>

<tr>

<td>pi</td>

<td><input type="text" name="pin" /></td>

</tr>

<tr>

<td>&nbsp;</td>

<td> <input type="submit" name="11"/> </td>

</tr>

</table>

</form>


<?php


if (isset($_POST['11']))

{


mysql_connect("localhost","root","");

mysql_select_db("test1");

$query="INSERT INTO `tablename` (`field1`, `field2`, `field3`) VALUES ('".$_POST['user']."', '".$_POST['address']."', '".$_POST['pin']."')";

mysql_query($query);

echo "Data inserted";

}

else

{


}

?>

</body>

</html>

1 comment:

Anonymous said...

oh great php programming lessons. Keep it up with latest updates in languages.