zinctek Posted October 18, 2007 Share Posted October 18, 2007 Hello all i have just made a script ( my first 1 ) and its the following code <?php if(isset($_POST['submit'])) { $to = "support@backupclick.com"; $subject = "download client"; $name = $_POST['name']; $email1 = $_POST['email1']; $email2 = $_POST['email2']; $telephonenumber = $_POST['telephonenumber']; $hearaboutus = $_POST ['heardaboutus']; foreach($_POST as $value) { $check_msg .= "Checked: $value\n"; } $body = " From: $name\n Email: $email1\n Email (check): $email2\n Telephone: $telephonenumber\n Hear About Us: $heardaboutus\n " ; mail($to, $subject, $body); } header( 'Location: download1.html' ); now it redirects to download1.html but for some reason its not sending me the email could anyone help me and tell me why? thank you Quote Link to comment https://forums.phpfreaks.com/topic/73864-script-help-with-a-mail-script/ Share on other sites More sharing options...
Daukan Posted October 18, 2007 Share Posted October 18, 2007 You have an if statement where $_POST['submit'] has to be set or the script inside won't run. But since the header redirect is outside the statement it will alway redirect. Force the statement to be true to test it, or just temporally remove it. Quote Link to comment https://forums.phpfreaks.com/topic/73864-script-help-with-a-mail-script/#findComment-372688 Share on other sites More sharing options...
zinctek Posted October 19, 2007 Author Share Posted October 19, 2007 i dont understand sorry what is it you want me to get rid off? am new to php just need a guide really ( that means told exactly what 2 do ) Quote Link to comment https://forums.phpfreaks.com/topic/73864-script-help-with-a-mail-script/#findComment-373005 Share on other sites More sharing options...
enoyhs Posted October 19, 2007 Share Posted October 19, 2007 Comment out "header( 'Location: download1.html' );" and test if mail works. Also you have mail server running on your testing server right? if you are testing pages locally make sure you have mail service installed. Quote Link to comment https://forums.phpfreaks.com/topic/73864-script-help-with-a-mail-script/#findComment-373007 Share on other sites More sharing options...
zinctek Posted October 19, 2007 Author Share Posted October 19, 2007 fixed the problem, submit i needed a cap S because its a Cap S in the Html code! thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/73864-script-help-with-a-mail-script/#findComment-373554 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.