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> 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'); 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'); } 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. 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 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
Archived
This topic is now archived and is closed to further replies.