Web Hosting Talk







View Full Version : PHP mailing... i need help..


Studio-10
08-10-2004, 10:27 PM
Ok, I get an error with this script:

<?php
mail("jobs@nocturn.liquidgoat.com", "$name", "$email", "$website", "$wanted", "$qualifications");
echo("Thanks $email<BR />Below shows what was sent<BR /><BR />Subject: Staff Signup<BR />
name: $name
email: $email
website: <a href="$website">click</a>
wanted :$wanted
qualifications:<br />
$qualifications);
?>

The error I get is:

Parse error: parse error, unexpected T_VARIABLE in /home/nocturn/public_html/send.php on line 6

Doh004
08-10-2004, 10:35 PM
First, you didn't close off your echo.

Second if you are going to use " with echos, you need to escape all other " in the echo. Just add a \ infront of every " that you use. This should work:


<?php
mail("jobs@nocturn.liquidgoat.com", "$name", "$email", "$website", "$wanted", "$qualifications");
echo("Thanks $email<BR />Below shows what was sent<BR /><BR />Subject: Staff Signup<BR />
name: $name<BR />
email: $email<BR />
website: <a href=\"$website\">click</a><BR />
wanted :$wanted<BR />
qualifications:<br />
$qualifications");
?>


I think thats how you want it to show ;)

Studio-10
08-10-2004, 10:36 PM
it gives me this error now:
Parse error: parse error, unexpected $ in /home/nocturn/public_html/send.php on line 11

Doh004
08-10-2004, 10:37 PM
I re edited my post. I had forgotten the " ;)

kneuf
08-10-2004, 10:39 PM
try this:

<?php
$subject = "Staff Signup";
$message = "
Name: $name
eMail: $email
WebSite: $website
Wanted: $wanted
Qualifications: $qualifications
";
mail("jobs@nocturn.liquidgoat.com", $subject, $message);
echo("Thanks $email<BR />Below shows what was sent<BR /><BR />Subject: Staff Signup<BR />
name: $name
email: $email
website: <a href='$website'>click</a>
wanted :$wanted
qualifications:<br />
$qualifications";
?>

also check out the php docs for the mail() function: http://ca2.php.net/manual/en/function.mail.php