BittenApple
Programmer
Hi, ive got a HTML form all sorted, and you type in your name/e-mail/mobile and a comment, would this be a correct script to add it to a database?
My friend gave me that script, but hes not a php genius and neither am I - I found a tutorial similar to that but it's not very helpful. I've only been looking at php tutorials for about 3 days.. anyone care to give me a hand.
Code:
<?
$username="username";
$password="password";
$database="your_database";
$first=$_POST['first'];
$last=$_POST['last'];
$mobile=$_POST['mobile'];
$email=$_POST['email'];
$message=$_POST['message'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$mobile','$email','$message')";
mysql_query($query);
mysql_close();
?>