hi,
sorry, am a newbee in php, i created a basic form that would add a data using mysql, however, everytime i test and tried to click the refresh button the page adds a new blank record in the database without clicking the send button, why is that happening?, the database is however working fine..
here the simple script:
<?php
$username="user";
$password="password";
$database="database";
$localhost ="localhost";
$first=$_POST['first'];
$last=$_POST['last'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$fax=$_POST['fax'];
$email=$_POST['email'];
$web=$_POST['web'];
mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to Connect to Database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email', '$web')";
mysql_query($query);
mysql_close();
?>
thanks for helping ..
jofet
sorry, am a newbee in php, i created a basic form that would add a data using mysql, however, everytime i test and tried to click the refresh button the page adds a new blank record in the database without clicking the send button, why is that happening?, the database is however working fine..
here the simple script:
<?php
$username="user";
$password="password";
$database="database";
$localhost ="localhost";
$first=$_POST['first'];
$last=$_POST['last'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$fax=$_POST['fax'];
$email=$_POST['email'];
$web=$_POST['web'];
mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to Connect to Database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email', '$web')";
mysql_query($query);
mysql_close();
?>
thanks for helping ..
jofet