Jump to content

Header redirect in if statement


gum1982

Recommended Posts

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

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.