rodn29 Posted July 19, 2007 Share Posted July 19, 2007 Hi, I am having trouble with a form. I would like someone to enter their name and email (that info is then sent to my e-mail address). Also, after entering their information the user should be taken to a new page (test.html). My ISP wrote a quick PHP script but when run it generates hundreds of blank e-mails and the page does not forward to test.html. This is the script: <?php $headers = 'From: [email protected]'; $recipient = '[email protected]'; $name = $_POST['required-Name']; $email = stripslashes($_POST['required-e-mail']); mail($recipient, $name, $email, $headers, '[email protected]'); ?> <h1> <meta http-equiv="Refresh" content="1; http://www.mg-interactive.com/test.html"> </h1> Any ideas? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/60781-solved-help-with-a-form/ Share on other sites More sharing options...
thedarkwinter Posted July 19, 2007 Share Posted July 19, 2007 maybe you can try: <?php $headers = 'From: [email protected]'; $recipient = '[email protected]'; $name = $_POST['required-Name']; $email = stripslashes($_POST['required-e-mail']); mail($recipient, $name, $email, $headers, '[email protected]'); header("location: test.html"); ?> and drop the html at the end. im assuming this isn't test.html? Link to comment https://forums.phpfreaks.com/topic/60781-solved-help-with-a-form/#findComment-302364 Share on other sites More sharing options...
predator12341 Posted July 19, 2007 Share Posted July 19, 2007 here you go <? $to = "";//your email add $sub = "Message from you website"; $msg = "The users name ".$_POST['required-Name']." <br />The users email ".$_POST['required-e-mail'].""; mail($to, $subject, $msg,"Content-Type: text/html\r\nFrom: [email protected]"); header("Location: ENTER HERE");//REPLACE ENTER HERE WITH THE PAGE YOU WANT THE USER TO BE REDIRECTED TO ?> regards Mark Link to comment https://forums.phpfreaks.com/topic/60781-solved-help-with-a-form/#findComment-302367 Share on other sites More sharing options...
dbo Posted July 19, 2007 Share Posted July 19, 2007 Hah, if it is test.html that would explain all the emails. Link to comment https://forums.phpfreaks.com/topic/60781-solved-help-with-a-form/#findComment-302370 Share on other sites More sharing options...
rodn29 Posted July 19, 2007 Author Share Posted July 19, 2007 Yup, that did it. Thanks soooo much! Link to comment https://forums.phpfreaks.com/topic/60781-solved-help-with-a-form/#findComment-302382 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.