lingo5 Posted June 8, 2011 Share Posted June 8, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/238765-help-passing-form-variable/ Share on other sites More sharing options...
gristoi Posted June 8, 2011 Share Posted June 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238765-help-passing-form-variable/#findComment-1226873 Share on other sites More sharing options...
lingo5 Posted June 8, 2011 Author Share Posted June 8, 2011 Gristoi, thanks lot, that worked fine. No offence taken at all!!!....I am still learning PHP.... Quote Link to comment https://forums.phpfreaks.com/topic/238765-help-passing-form-variable/#findComment-1226875 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.