JudithARyan
asked on
Mail via php
I'm trying to pass parameters between two php pages and then send email. I get a parse error on the $subject line on the 2nd page and I'm not sure the parameters from the 1st page are being picked up. What's my problem????
Here's my code:
From Page1.php:
<a href="Page2.php?ID=$Servic eRequest[I D]&Neighbo r=$Service Request[Ne ighbor]&Da te=$Servic eRequest[S vcDate]">I 'll Do This!</a>
To Page2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank You for Volunteering!</title>
</head>
<body>
<?php
$ID=$HTTP_GET_VARS['ID'];
$Neighbor=$HTTP_GET_VARS[' Neighbor'] ;
$Date=$HTTP_GET_VARS['Date '];
$to = "reqdesk@vvcaregivers.org" ;
$subject = "I'll do " . $ID . " for " . $Neighbor;
$message = "volunteer for service";
mail(&to,$subject,$message );
echo "Mail Sent";
</body>
</html>
Here's my code:
From Page1.php:
<a href="Page2.php?ID=$Servic
To Page2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank You for Volunteering!</title>
</head>
<body>
<?php
$ID=$HTTP_GET_VARS['ID'];
$Neighbor=$HTTP_GET_VARS['
$Date=$HTTP_GET_VARS['Date
$to = "reqdesk@vvcaregivers.org"
$subject = "I'll do " . $ID . " for " . $Neighbor;
$message = "volunteer for service";
mail(&to,$subject,$message
echo "Mail Sent";
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help, I'll try both suggestions and let you know how I did.
Judith
Judith
ASKER
DaveBaldwin, since the first section of your demo isn't in a <html .... </html> page, am I supposed to insert the first section in one of my own pages? Sorry for my ignorance, I'm really new to php.
Thanks for your help. Judith
Thanks for your help. Judith
No, that is a complete page on it's own. The PHP runs on the server and the HTML including any generated by PHP gets sent to the browser. My demo has a form on it that posts the info back to itself on the server where it gets processed and the results sent to your browser.
ASKER
Thanks so much for your help. Sorry for the delay
Open in new window
looks funky. Are the three variables buried in the query string? If so, it should beOpen in new window
Whenever you want to use PHP code, it has to be between <?php ?>In the code for page 2, this line
Open in new window
should beOpen in new window