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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.