I have created a php coding to insert data in to the my sql database table. But the...

Nipuni

New member
...records are not inserti? I have created a php coding to insert data in to the my sql database table. But the records are not inserting.
I have created a form using html and wrote the coding in php to insert records in to the database table in mysql. But the data that I insert using the form are not inserting in to the table. But there is no error message even. Please help?
Here is my coding.
<html>
<head>
</head>
<body>
<table>
<form method="post" action="exe_2.php">

<tr>
<td>User Name</td>
<td><input type="text" name="name"></td>
</tr>

<tr>
<td>Password</td>
<td><input type="password" name="paword"></td>
</tr>

<tr>
<td>Email</td>
<td><input type="text" name="email"></td>
</tr>

<tr>
<td></td>
<td><input type="submit" name="submit" value="register"></td>
</tr>
</table>
</form>


</body>

</html>

<?php
error_reporting(0);
$con = mysql_connect("localhost","root","root");
mysql_select_db("bit",$con);
$insert="INSERT INTO student
(StdNo,User Name,Password,Email) VALUES
('null','$_POST[name]','$_POST[paword]','$_POST')";

//if (isset($_POST['submit']))
//{
mysql_query($insert,$con);
echo "your record added";
//}
$view="SELECT * FROM student";
$result=mysql_query($result,$con);
echo "<table border='1'>
<tr>
<th>StdNo</th>
<th>User Name</th>
<th>Password</th>
<th>Email</th></tr>"
;

while ($display=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $display['StdNo'] . "</td>";
echo "<td>" . $display['User Name'] . "</td>";
echo "<td>" . $display['Password'] . "</td>";
echo "<td>" . $display['Email'] . "</td>";
echo "</tr>";
}

echo "</table>";



mysql_close($con);
?>
 
Back
Top