jas4 Posted September 11, 2007 Share Posted September 11, 2007 Hi i'm trying to send an email using data collected through a post form. Problem is when it comes to the email message and things like <img src="link.gif"> here is the code I've got at the moment: $message1 = $_POST['emailMessage']; <---the posted form data that is the body that send something through like this: <p>this is another = <strong>have some bold</strong></p> <p><img src="http://www.google.co.uk/intl/en_uk/images/logo.gif" alt="" /></p> So I put message 1 through this piece of code: if ( get_magic_quotes_gpc() ) $message = htmlspecialchars( stripslashes( $message1 ) ) ; else $message = htmlspecialchars( $message1 ) ; and $message returns code like this <p>SPETthis is another = <strong>have some bold</strong></p> <p> <img src="http://www.google.co.uk/intl/en_uk/images/logo.gif" alt="alt text" /></p> so now I put $message in the email body, but when I check the code of the email it looks like: <p>SPETthis is another = <strong>have some bold</strong></p> <p><img alt=\'\' src=\'http://www.google.co.uk/intl/en_uk/images/logo.gif\' /></p><br><Br> and the image does not appear ??? Quote Link to comment https://forums.phpfreaks.com/topic/68838-solved-get_magic_quotes_gpc-problem/ Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 use strip_slashes Quote Link to comment https://forums.phpfreaks.com/topic/68838-solved-get_magic_quotes_gpc-problem/#findComment-346014 Share on other sites More sharing options...
jas4 Posted September 11, 2007 Author Share Posted September 11, 2007 ok so i cut this down... if ( get_magic_quotes_gpc() ) $message = htmlspecialchars( stripslashes( $message1 ) ) ; else $message = htmlspecialchars( $message1 ) ; to this.. $message = stripslashes( $message1 ) ; and it works should I check to see if ( get_magic_quotes_gpc() ) first? Quote Link to comment https://forums.phpfreaks.com/topic/68838-solved-get_magic_quotes_gpc-problem/#findComment-346019 Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 No, you should have that. Perhaps it's magic_quotes_runtime that is adding the slashes? You don't have any escape functions on the strings anywhere else? Also if you're trying to send html in the email I think you don't want to use htmlspecialchars. Quote Link to comment https://forums.phpfreaks.com/topic/68838-solved-get_magic_quotes_gpc-problem/#findComment-346022 Share on other sites More sharing options...
jas4 Posted September 11, 2007 Author Share Posted September 11, 2007 no, after its been through stripslashes, it goes straight into the email, so it works fine. thanks - topic solved! Quote Link to comment https://forums.phpfreaks.com/topic/68838-solved-get_magic_quotes_gpc-problem/#findComment-346029 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.