My host port is localhost:8080, database faiza.
My php code fails to insert data.
There is code:
<?php
if(isset($_POST["btnSubmit"])){
$name =$_POST["txtName"];
$mail =$_POST["txtEmail"];
$phone =$_POST["txtPhone"];
$con = mysql_connect("localhost:8080","root","");
mysql_select_db("faiza", $con);
$sql="insert into contact(name,email,phone) values ('$name','$mail','$phone')";
mysql_query($sql);
mysql_close($con);
}
?>
<div style="height:300px; margin:0 auto; width:80em;">
<body>
<form action="#" method="post">
<table>
<tr>
<td>Name*</td>
<td><input type="text" id="txtName"/></td>
</tr>
<tr>
<td>Email Address*</td>
<td><input type="text" id="txtEmail"/></td>
</tr>
<tr>
<td>Phone*</td>
<td><input type="text" id="txtPhone"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" id="btnSubmit" value="Submit"/></td>
</tr>
</table>
</form>
</body>
</div>
Comments 11