Jump to content

[SOLVED] using variables in variables.


denoteone

Recommended Posts

I have a Variable $emailmessage that has html in it and to make it customized it also has the reader’s name. That was submitted by the form. So it looks something like this.

 


$name2 = $_POST['guestname2'];

$emailmessage= '
<html>
  <body bgcolor="white">

<table align="center" border="1" bordercolor="gray" width="400px">
    <tr>
       <td>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=14pt">Dear $name2</font><br/><br/>
</tr>
      </td>
</table>
</body>
</html>';

 

when I send my emailmessage it does not show the value of $name2 it just shows $name2

Link to comment
https://forums.phpfreaks.com/topic/84315-solved-using-variables-in-variables/
Share on other sites

This will work mate

 

$name2 = $_POST['guestname2'];

$emailmessage= '
<html>
  <body bgcolor="white">

<table align="center" border="1" bordercolor="gray" width="400px">
    <tr>
       <td>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=14pt">Dear '.$name2.'</font><br/><br/>
</tr>
      </td>
</table>
</body>
</html>';

 

Regards

Liam

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.