Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a varible in email script

Status
Not open for further replies.

kjspear

Programmer
Joined
Feb 13, 2002
Messages
173
Location
US
Hello,

I need help with a script. Basically all I'm trying to do is pass a varible $yo="k" to go into the $message body in an email. What I want this script to do is randomly generate a user ID and Password, then place the result in the message of the email. Here's the sample I did;


<?php
function hy()
{
//random generator

}
$yo=&quot;k&quot;;
/* recipients */
$to = &quot;mkt2000@aol.com&quot; . &quot;, &quot; ; // note the comma

/* subject */
$subject = &quot;Registration Instructions&quot;;

/* message */
$message='
<html>
<head>
<title>Registration Instructions</title>
</head>
<body>
<p>Below is the information you will need to log onto peter.com</p>
<table>
<tr>
<th>$yo</th><th>Password</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally </td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
<p>Please store this information in a safe place.</p>Please click or type url below;<br>
<p><a href=&quot;mysite.com&quot;>Mysite</a></p>
</body>
</html>

I would appreiciate any assistance.

Thanks

Kyle
 
I believe if you use single quotes you tell PHP to use the string as is and not to process it. So use double quotes.

Alternatively you could break the string like:

$message='
<html>
<head>
<title>Registration Instructions</title>
</head>
<body>
<p>Below is the information you will need to log onto peter.com</p>
<table>
<tr>
<th>'.$yo.'</th><th>Password</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally </td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
<p>Please store this information in a safe place.</p>Please click or type url below;<br>
<p><a href=&quot;mysite.com&quot;>Mysite</a></p>
</body>
</html>'


Bret Lanius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top