...

View Full Version : Newb Writing Scripts...Debug This?



As5a5sIn5
05-19-2004, 02:49 AM
I get this error...

Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /gfdhhgshsgsdhs/jacostuff.com/httpdocs/updates.php on line 3

with this code...



<html>
<font face="Tunga">You Will Be Soon Redirected!</font>
<?php
mail(
"$_POST["email"];",
"Welcome $_POST["name"];",
Just e-mailing you to inform you that you will recieve site updates\n thanks for Joining,
\n JAcostuff.com
");
?>
<?php
mail(
"AnthonyHurst@spamblack.com;",
"Welcome $_POST["name"];",
"Add $_POST["name"]; to the list of people receiving updates,\nTheir E-mail is $_POST["email"];
");
?>
</html>

Antoniohawk
05-19-2004, 03:07 AM
Slap a <br> in place of every \n, that should work.

As5a5sIn5
05-19-2004, 03:46 AM
nope...same error...i think it has 2 do with puttin the variable in the e-mail address....not sure tho....anyone else know?

l3vi
05-19-2004, 04:27 AM
It does have to do with that, you cant write: "$_POST["email"]";

You either have to use, ''
or not use quotes at all: $_POST[email]
either will work...

You need to do this every time you use post/get variables

firepages
05-19-2004, 04:51 AM
l3vi is on the right track e.g.



<?
mail(
$_POST['email'],
"Welcome {$_POST['name']}",
'Just e-mailing you to inform you that you will recieve site updates
thanks for Joining',
"JAcostuff.com\n";
");
?>


but there are other simple parse errors (unquoted strings etc)

to use $_POST['an_array_value'] within a " " quoted string you need to add braces around it {} (>=PHP 4.2.*) or simply concatenate ..
"Welcome ".$_POST['name']."blah",

$_POST[variable] , will work but technically its incorrect and will produce an E_NOTICE internally.

You do not need the ';' at the end of PHP variables when used within a string (not that it causes an error either)

try formatting your code as above , or at least diferently as it makes simple mistakes far easier to spot... for both you and us ;)

Antoniohawk
05-19-2004, 04:51 AM
Sorry about that, I just attempted to google the answer. So much for my nonexistent php skills.

firepages
05-19-2004, 04:56 AM
Sorry about that, I just attempted to google the answer. So much for my nonexistent php skills.

narrowing down what it isn't , is still part of the solution every time :thumbsup:

As5a5sIn5
05-19-2004, 05:28 AM
Thanks....Once my sites done I;m gonna have a big thank you notice on it!
lol
it's
http://jacostuff.com/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum