Jump to content

Help passing form variable


lingo5

Recommended Posts

Hi,

I have this form variable:

$_POST['company_name']

and I need to pass it to the next page as text.

Ive tried this

header("Location: EST_quotation_insert.php?company_name = $_POST['company_name']"); 
}

but it doesn't work. I know I'm making a mistake somewhere, but I'm still learning. Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/238765-help-passing-form-variable/
Share on other sites

Firstly, and dont take offence to this. Do you understand that by passing a variable through the URL you are changing it from a POST to a GET variable.. So the follwoing should work:

$companyName = $_POST['company_name'];
header("Location: EST_quotation_insert.php?company_name=$companyName"); 

// then on the EST_quotation_insert.php page

$companyName = $_GET['company_name'];

also ensure you done have any spaces in your url string. you had a space between the = symbol. And dont forget to ensure your POST variable is correctly sanatised

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.