robin339 Posted March 7, 2007 Share Posted March 7, 2007 Hey guys, How do i make a "email me this info" page from a order confirmation page? Basically someone enters some info in a form, then on submission is comes to my email. After submission, i want to have a text area where they can enter an email address to have the info emailed to them if they wish. You can see the page here, you have to enter info first, the email nbox on the second page (process.php) is non fuctional. Click here Thanks Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/ Share on other sites More sharing options...
fert Posted March 7, 2007 Share Posted March 7, 2007 http://us2.php.net/mail Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-201390 Share on other sites More sharing options...
robin339 Posted March 7, 2007 Author Share Posted March 7, 2007 http://us2.php.net/mail Thanks But the email adress it is going to be sent to is dynamic. The user will enter the email it needs to be sent to. Therefore, I cant predefine an email address. Thanks Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-201396 Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 this took ages to work out but here you go you can send an email to client and ur company or just to company. <?php $mail_date = date('l dS \of F Y h:i:s A'); $email_url = $_SERVER['PHP_SELF']; $email_ip = $_SERVER['REMOTE_ADDR']; $x=array("users_email@what_ever.com","company@what_ever.com"); $a=$x[0]; $c=$x[1]; foreach($x as $key => $val){ if($b=="yes"){ $val="$a,$c"; $val=str_replace("yes","",$val); } if($b=="no"){ $val=$c; } $to = $val; } $subject2 = "Email Subject"; $email = "The following page, $email_url , was accessed. IP: $email_ip Date: $mail_date This is an automated email! DO NOT REPLY!"; $from = "[email protected]"; $headers1 = "MIME-Version: 1.0\r\n"; $headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers1 .= "To: ".$to."\r\n"; $headers1 .= "From: ".$from."\r\n"; $headers1 .= "Reply-To: ".$from."\r\n"; mail($to, $subject2, $email, $headers); echo" <form method='POST' action=''> <select name='b'> <option value='yes'>yes</option> <option value='no'>no</option> </select> <input type='submit' name='submit' value='send email'> </form>"; ?> Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-201467 Share on other sites More sharing options...
chronister Posted March 7, 2007 Share Posted March 7, 2007 You don't have to hard code the email address in the mail function. $to=$_POST['email_address']; $subject="some subject here... can come from a $_POST[] field too."; $body="This is the body of the email.... it too can come from a $_POST[] field"; $header='this is where you put headers like content type, from, cc, bcc, etc"; mail($to, $subject, $body, $header); Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-201483 Share on other sites More sharing options...
robin339 Posted March 7, 2007 Author Share Posted March 7, 2007 Whoa guys !! THANKS !!!!! Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-201985 Share on other sites More sharing options...
robin339 Posted March 8, 2007 Author Share Posted March 8, 2007 where would they get to enter the email address that they want it sent to? Sorry, noob here Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-202240 Share on other sites More sharing options...
chronister Posted March 8, 2007 Share Posted March 8, 2007 create a form field called email <input name="email" type="text" id="email"> Then on the page that is going to process the form, add this. <?php $to=$_POST['email']; // this line right here accepts the input box and sets to a variable called $to. $subject="some subject here... can come from a $_POST[] field too."; $body="This is the body of the email.... it too can come from a $_POST[] field"; $header='this is where you put headers like content type, from, cc, bcc, etc"; mail($to, $subject, $body, $header); ?> Link to comment https://forums.phpfreaks.com/topic/41554-solved-how-to-create-a-email-me-this-info-page/#findComment-202302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.