flashx Posted November 6, 2010 Share Posted November 6, 2010 Hi guys, this is my first post, and im needing some help with email and variables in php. when i save this out it works: <?php $test = "hi there"; mail('[email protected]','test subject', 'This is a test'); ?> but as soon as i add variable into the mix it doesnt work... <?php $email = "[email protected]"; mail($email,'test subject', 'This is a test'); ?> any clues? Quote Link to comment https://forums.phpfreaks.com/topic/217929-email-php-and-variables-eeik/ Share on other sites More sharing options...
Adam Posted November 6, 2010 Share Posted November 6, 2010 Do you get an error, or do you just not receive the email? Quote Link to comment https://forums.phpfreaks.com/topic/217929-email-php-and-variables-eeik/#findComment-1131057 Share on other sites More sharing options...
Rifts Posted November 6, 2010 Share Posted November 6, 2010 try this mail( '$email' ,'test subject', 'This is a test'); Quote Link to comment https://forums.phpfreaks.com/topic/217929-email-php-and-variables-eeik/#findComment-1131102 Share on other sites More sharing options...
Adam Posted November 6, 2010 Share Posted November 6, 2010 Variables within single quotes aren't parsed. Quote Link to comment https://forums.phpfreaks.com/topic/217929-email-php-and-variables-eeik/#findComment-1131104 Share on other sites More sharing options...
Rifts Posted November 6, 2010 Share Posted November 6, 2010 well thats the only way it works on my computer Quote Link to comment https://forums.phpfreaks.com/topic/217929-email-php-and-variables-eeik/#findComment-1131107 Share on other sites More sharing options...
Adam Posted November 6, 2010 Share Posted November 6, 2010 Sorry but you're wrong. Perhaps you're using double-quotes? Quote Link to comment https://forums.phpfreaks.com/topic/217929-email-php-and-variables-eeik/#findComment-1131109 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.