Click to See Complete Forum and Search --> : AutoEmailing Code Errors


baylee
10-22-2006, 09:18 PM
Here is my code. It is supposed to email the page to the specified email address but it returns an error when I enter it into PhP.

<?php
$email = $HTTP_POST_VARS[email];
$mailto = "bayleewebb@bellsouth.net";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody =$_SERVER['REQUEST_URI'] . "." .$_SERVER['HTTP_USER_AGENT'] . "." . "$REMOTE_ADDR.".".Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$mailbody .= "$key : $val\n"; }
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>



Here is the error:
Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?php
$email = $HTTP_POST_VARS[email];


SQL query:

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
$email = $HTTP_POST_VARS[email]' at line 1

chazzy
10-22-2006, 09:21 PM
you have errors in your script way before this is called. is this code included in another file for calling or is this called directly? is there code that occurs before this?

baylee
10-22-2006, 09:24 PM
this is the only code. I'm trying to upload the file to my webhosts php database

baylee
10-22-2006, 09:40 PM
I'm trying to import this as a file into my PHP...maybe thats not even right...

felgall
10-22-2006, 09:45 PM
The error message indicates that is is expecting an SQL command to be entered and not just the PHP that is to be added. The PHP would be the value that you are loading but it needs to be included in the SQL command that does the actual loading of it into the database.

baylee
10-22-2006, 09:47 PM
can you tell me what that is?