pemdas21 Posted January 7, 2007 Share Posted January 7, 2007 Okay, anyone remember that webmail form? If not, this oughta jog your memory...[code]<?PHPif (isset($_POST['Email']) && isset($_POST['Person']) && isset($_POST['Message']) && isset($_POST['Subject'])) { $Email = $_POST['Email']; $Person = $_POST['Person'];}if ($Person == "John Doe") {$mailto = "[email protected]";}if ($Person == "Jo Shmoe") {$mailto = "[email protected]";}}// repeat the above If statement as many times as the persons$mailsubj = $HTTP_POST_VARS['Subject'];$Message = $HTTP_POST_VARS['Message'];$mailhead = "$Email\n";$mailbody = "$Message\n";echo "\n";echo "Email sent through our Web Mail form\n";mail($mailto, $mailsubj, $mailbody, $mailhead);?>[/code]I have a hidden form field named redirect that has a value of http://www.orrita.com/How do I make the script redirect... Help? Link to comment https://forums.phpfreaks.com/topic/33184-redirect-after-php-script-executes/ Share on other sites More sharing options...
DarkendSoul Posted January 7, 2007 Share Posted January 7, 2007 Theres two ways you could do this. Php way:[code=php:0]header("Location: your site here");[/code]Javascript way:<script language="javascript" type="text/javascript">location.href="your website";</script> Link to comment https://forums.phpfreaks.com/topic/33184-redirect-after-php-script-executes/#findComment-154869 Share on other sites More sharing options...
pemdas21 Posted January 7, 2007 Author Share Posted January 7, 2007 with the php way, I just put that at the top of the php script? Link to comment https://forums.phpfreaks.com/topic/33184-redirect-after-php-script-executes/#findComment-154871 Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Share Posted January 7, 2007 yes, but it would skip the rest of your script. youll have to use the javascript way, becauase the header() only works before youve given output from the script Link to comment https://forums.phpfreaks.com/topic/33184-redirect-after-php-script-executes/#findComment-154873 Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 Remove this....[code=php:0]echo "\n";echo "Email sent through our Web Mail form\n";[/code]its pointless anyway. Then place the call to header() after you call the mail() function. Link to comment https://forums.phpfreaks.com/topic/33184-redirect-after-php-script-executes/#findComment-154907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.