redgunner Posted August 21, 2009 Share Posted August 21, 2009 $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); How do I replace the value [email protected] with the value entered $_POST['emailaddress'] from the previous webpage with a form? Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/ Share on other sites More sharing options...
Garethp Posted August 21, 2009 Share Posted August 21, 2009 $Mail = mysql_escape_string($_POST['emailaddress']); $headers = 'From: ' . $Mail . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903079 Share on other sites More sharing options...
pornophobic Posted August 21, 2009 Share Posted August 21, 2009 $mail = mysql_real_escape_string($_POST['emailaddress']); $headers = 'From: ' .$mail . "\r\n" . 'Reply-To: ' . $mail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); @Garethp - mysql_escape_string() has been deprecated. Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. click Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903082 Share on other sites More sharing options...
Garethp Posted August 21, 2009 Share Posted August 21, 2009 $mail = mysql_real_escape_string($_POST['emailaddress']); $headers = 'From: ' .$mail . "\r\n" . 'Reply-To: ' . $mail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); @Garethp - mysql_escape_string() has been deprecated. Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. click I'll stop using it when I have an alternate that does not rely on a database connection. When I use a database, I'll use real escape, but as a force of habit I use mysql_escape_string(); to sanatize even when I don't have Database needs Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903095 Share on other sites More sharing options...
Daniel0 Posted August 21, 2009 Share Posted August 21, 2009 $Mail = mysql_escape_string($_POST['emailaddress']); Uh... might I ask why you're doing that? Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903108 Share on other sites More sharing options...
Garethp Posted August 21, 2009 Share Posted August 21, 2009 $Mail = mysql_escape_string($_POST['emailaddress']); Uh... might I ask why you're doing that? Force of habit I guess. I 'spose it'd be easier to just do FROM: $_POST but when I started off I had some real problems with MySQL and Post functions unless I predeclared them first and used the alternative var. Since then it's just been a habit Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903115 Share on other sites More sharing options...
newbtophp Posted August 21, 2009 Share Posted August 21, 2009 add: $headers = 'From: $emailaddress' . "\r\n" . 'Reply-To: $emailaddress' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $emailaddress = $_REQUEST['emailaddress'] ; You'd now have to add emailaddress as the field name for the email address on the previous page. Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903117 Share on other sites More sharing options...
trq Posted August 21, 2009 Share Posted August 21, 2009 $Mail = mysql_escape_string($_POST['emailaddress']); Uh... might I ask why you're doing that? Force of habit I guess. I 'spose it'd be easier to just do FROM: $_POST but when I started off I had some real problems with MySQL and Post functions unless I predeclared them first and used the alternative var. Since then it's just been a habit One that you should drop. Its of absolutely no benefit. Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903121 Share on other sites More sharing options...
Daniel0 Posted August 21, 2009 Share Posted August 21, 2009 add: $headers = 'From: $emailaddress' . "\r\n" . 'Reply-To: $emailaddress' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $emailaddress = $_REQUEST['emailaddress'] ; You'd now have to add emailaddress as the field name for the email address on the previous page. Won't work. Variables won't be interpolated in single quote delimited strings. Link to comment https://forums.phpfreaks.com/topic/171259-mail-function/#findComment-903123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.