message in mail function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gecko
Forum Commoner
Posts: 34
Joined: Thu Oct 24, 2002 3:45 am

message in mail function

Post by gecko »

dear all,
i would like the following html body to be send to an email box:

$message = '
<html>
<head>
<title>Mail</title>
</head>
<body bgcolor="#CCFFCC" >
<form method="post" action="http://www.xxxx.com" id=form1 name=form1>
Email Address: <input name="email" size="32"> <input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
';

the mail function is working fine. the person who receives this mail can send it through to another person, by filling in the email address of that person.

i would like to personalise the message by including a "dear x" x being the name of the person that was provided in the form fiels "email". i suspect that I then have to include a echo '$email' somewhere in the variable $message. Is this possible? I have been trying, but i am not able to find the correct format for including it in the message.

can someone help?

thanks hans
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

If you want to add a variable's value to another variable, escape your string, and concatenate, like so:

Code: Select all

<?php
$text = 'cheese';
$longtext = 'I like to eat ' . $text . ' on weekends.";
?>
Post Reply