denoteone Posted January 3, 2008 Share Posted January 3, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/84315-solved-using-variables-in-variables/ Share on other sites More sharing options...
shocker-z Posted January 3, 2008 Share Posted January 3, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/84315-solved-using-variables-in-variables/#findComment-429368 Share on other sites More sharing options...
denoteone Posted January 3, 2008 Author Share Posted January 3, 2008 thank you sir! Quote Link to comment https://forums.phpfreaks.com/topic/84315-solved-using-variables-in-variables/#findComment-429375 Share on other sites More sharing options...
revraz Posted January 3, 2008 Share Posted January 3, 2008 It's because your variable is behind single quotes. So shocker removed them from the quotes and then continued it after. Quote Link to comment https://forums.phpfreaks.com/topic/84315-solved-using-variables-in-variables/#findComment-429376 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.