gum1982 Posted November 4, 2009 Share Posted November 4, 2009 Can someone please tell me why my header redirect isnt working i simply want it to redirect if their is nothing entered in the input field of the form. if(trim($_POST )==''){ header('Location:http://www.example.php'); } this is the input field <label> Code : <input value="<?php echo $_POST[code]; ?>" type="text" name="code" /> </label> Quote Link to comment https://forums.phpfreaks.com/topic/180207-header-redirect-in-if-statement/ Share on other sites More sharing options...
MadTechie Posted November 4, 2009 Share Posted November 4, 2009 try if(empty($_POST['code'])) header('Location:http://www.example.php'); Quote Link to comment https://forums.phpfreaks.com/topic/180207-header-redirect-in-if-statement/#findComment-950626 Share on other sites More sharing options...
milesap Posted November 4, 2009 Share Posted November 4, 2009 Try: if (empty($_POST)) { header('Location: http://www.example.com'); } Quote Link to comment https://forums.phpfreaks.com/topic/180207-header-redirect-in-if-statement/#findComment-950627 Share on other sites More sharing options...
gum1982 Posted November 4, 2009 Author Share Posted November 4, 2009 Hello thanks for the reply's i tried but those options and it still doesnt work if(empty($_POST['code'])){ header('Location:http://www.warrenbrooksbutler.com/healthcheck/paypal.php'); } sorry my fault working now i had it half way down the page put it at the top and works great now thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/180207-header-redirect-in-if-statement/#findComment-950629 Share on other sites More sharing options...
MadTechie Posted November 4, 2009 Share Posted November 4, 2009 welcome, if solved can you click topic solved bottom left please Quote Link to comment https://forums.phpfreaks.com/topic/180207-header-redirect-in-if-statement/#findComment-950632 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.