hi
i m facing problem while m trying to insert a record from form into database..the empty records will be inserted.values are not inserted in it....no error is shown..
here is the html coding.......
here is the php coding.......
i m facing problem while m trying to insert a record from form into database..the empty records will be inserted.values are not inserted in it....no error is shown..
here is the html coding.......
Code:
<body> <form method="POST" action="p.php"> Firstname: <input type="text" name="FirstName" size="30" /><BR> <BR> <INPUT NAME="enter" TYPE="submit" VALUE="Enter"> </form> </body>
Code:
<?php
error_reporting(5);
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mydb", $con);
$sql="INSERT INTO stuinfo (FirstName) VALUES('$FirstName')";
if (!mysql_query($sql,$con))
{
die ('Error: '.mysql_error());
echo "Error in Record Submission";
}
echo "New Record Added ";
mysql_close($con) ;
?>
Comment