Forum Moderators: coopster
I've got everything set up but when I click the submit button I get this error:
-----------------------------------
Parse error: parse error, unexpected T_VARIABLE in /home/httpd/vhosts/example.com/httpdocs/holiday2004/thanks.php on line 144
-----------------------------------
I know how to make forms (using DW MX 2004, which I am) but don't really know PHP. I'm following some instructions from another website so I'm not exactly sure what's wrong.
This is the game page:
<snipped>
I'd post the link to the .php page as well, but it just comes up as an error. Basically it's like any other page on the site except the instrucitons had me add this in the body:
<SCRIPT LANGUAGE="php">
$email = $HTTP_POST_VARS[email];
$mailto = "user@example.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$mailbody .= "$key : $val\n"; }
mail($mailto, $mailsubj, $mailbody, $mailhead);
</SCRIPT>
Thanks,
m19
[edited by: coopster at 9:17 pm (utc) on Dec. 2, 2004]
[edit reason] removed urls per TOS [webmasterworld.com] [/edit]
143 - <SCRIPT LANGUAGE="php">
144 - $email = $HTTP_POST_VARS[email];
145 - $mailto = "user@example.com";
146 - $mailsubj = "Form submission";
147 - $mailhead = "From: $email\n";
148 - reset ($HTTP_POST_VARS);
149 - $mailbody = "Values submitted from web site form:\n";
150 - while (list ($key, $val) = each ($HTTP_POST_VARS)) {
151 - $mailbody .= "$key : $val\n"; }
152 - mail($mailto, $mailsubj, $mailbody, $mailhead);
153 - </SCRIPT>
Olwen, I also changed what you mentioned but to no effect, still get the error.
m19
[edited by: coopster at 9:18 pm (utc) on Dec. 2, 2004]
[edit reason] generalized url [/edit]
Then if that doesn't work, use:
143: <?PHP
...
153:?>
<?php
$email = $HTTP_POST_VARS[email];
$mailto = "user@example.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$mailbody .= "$key : $val\n"; }
echo "($mailto, $mailsubj, $mailbody, $mailhead)";
?> baze
[edited by: coopster at 9:26 pm (utc) on Dec. 2, 2004]
[edit reason] generalized url [/edit]
m19
If I remember correctly, when you create a PHP page in Dreamweaver, it will start PHP code with an xml DOCTYPE declaration, thereby serving up the page as XML/XHTML. And if you intend to embed PHP code in XML or XHTML, you will need to use the <?php. . .?> form of Escaping from HTML [php.net] to conform to the XML.