Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP HTTP POST Question - How do you pass data from multiple forms as HTTP Post?

Tags:

php

I have a step 1 page, and a step 2 page. I want to take the information from step 1 page, then step 2 page, and save as session information (which i have already done). Once this information is all gathered i then want to be able to submit it to another php page using HTTP POST.

like image 962
matt Avatar asked Feb 27 '23 03:02

matt


1 Answers

If you want to send the data using POST you'll need to bring those variables down as hidden input fields on your form before your users clicks submit:

<input type="hidden" name="firstname" value="<?php echo($_SESSION['firstname']); ?>" />
<input type="hidden" name="surname" value="<?php echo($_SESSION['surname']); ?>" />
<input type="hidden" name="age" value="<?php echo($_SESSION['age']); ?>" />

Alternatively you could just reference the $_SESSION when your at the processing stage, if this is applicable.

like image 113
Ben Everard Avatar answered Apr 26 '23 10:04

Ben Everard