Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi im new to php programming and i have created a form
that sends a email to an email address tht i specify. i want this
email to be displayed in a table in my database. i have
tried loads of different online tutorials etc. but keep
getting the same parse error. it is always on the line with
msql_connect(). i am wondering if there is some sort of
error with the usenames because from what i remember
we had a bit of trouble setting permissions, usernames
and password in mysql.
the root user has no password although i have set up
another user called guest with a password of password.
dunno if it makes it easier either way.anyways heres the code i have tried.
$fname = $_POST["first"];
$sname = $_POST["last"];
$email = $_POST["email"];
$msg = $_POST["message"];
$date = date('l dS F Y at h:i:s A');
mail('anon@anon.com', 'html form to email' ,
"From: $fname $sname \n email address: $email \n sent:
$date \n \n \n \t $msg")
$db = @mysql_connect('localhost', 'root', '');
mysql_select_db(test) ;
$result = "INSERT INTO messages ('first name' , 'last name'
, 'email address' , 'date' , 'message') VALUES ('$fname' ,
'$lname' , '$email' , '$date' , '$msg'")
mysql_query($sql)please help!
thanks
piercy

You've got quite a few errors...
1. You're missing a semicolon after the mail function (this is the one causing your problem.)
2. $result = "INSERT INTO..." should probably be $sql = "INSERT INTO..."
3. You're missing a semicolon after the statement referred to in issue #2
4. Missing a semicolon after mysql_query($sql).For future reference, you are much more likely to get answers when you post what the error is...It's not usually as obvious as these ones were.
Good luck,
-SN

![]() |
running shell script on X...
|
DLL and Embedded Programm...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |