hi everyone. I have just started to program in php. I tried to develop a php code to retrieve data from a form and insert into a table created in Mysql. Here is my php code. This code gets executed when the user submits the form.
<html>
<body>
<?php
$con = mysql_connect("localhost","####","####");
if(!$con){
die('Could not connect: '.mysql_error());}
mysql_select_db("wb", $con);
$sql="INSERT INTO users (username,password,mail,address,phone) VALUES ('$_POST[username]','$_POST[pwd]','$_POST[mail]','$_POST[Address]','$_POST[Phone]')";
if(!mysql_query($sql,$con)){
die('Error: '.mysql_error());}
echo "Successfully Registered!";
mysql_close($con);
?>
</body>
</html>
I neither get "Successfully registered" message nor the data gets inserted into the table. My page is blank after i press the submit button. What is wrong with the code??