Jump to content

Problem in posting values from different pages in same form!


joshi_v

Recommended Posts

Hello Everyone!


I had a form with radio buttons.form is spreaded for 4 pages.and all the radio buttons are selected in that form(all in 4 pages).now my problem is when i post the form , it is not posting all the radio button values selected in the form.It is only posting the values of the page from where i am saving the form. But i need all the selected values.

So please help me how to get all values?


Thanks!

Joshi.
You would either need to assign those POST values from page 1 as session variables in page 2 and then page 2 POST values as session variables in page 3 and then page 3 POST values as session variables in page 4 - or you would need to POST page 1 values again as hidden inputs on page 2 to page 3, and then hidden inputs from page 1, 2 & 3 to page 4.
Yes.But there is one problem. If i use session or hidden variables..it won't reflect the changes if i make any, after assigning values to that variables.For some reason i can't use hidden variables. So pls tell me any other option if is there?


Thanks!
Joshi.
Example, using similar logic mentioned above...

page1.php
[code]
<form action="page2.php" method="post">
<label><input type="radio" name="radio1" value="a">Radio 1a</label>
<label><input type="radio" name="radio1" value="b">Radio 1b</label>
<label><input type="radio" name="radio1" value="c">Radio 1c</label>
</form>
[/code]

page2.php
[code]
<form action="page3.php" method="post">
<label><input type="radio" name="radio2" value="a">Radio 2a</label>
<label><input type="radio" name="radio2" value="b">Radio 2b</label>
<label><input type="radio" name="radio2" value="c">Radio 2c</label>
<?php
echo "<input type=\"hidden\" name=\"radio1\" value=\"". htmlentities($_POST["radio1"]) . "\">";
?>
</form>
[/code]

ect...

Implementing a 'back' feature is also simple, following this principle...

ALTERNATIVLY, You could store the value of 'radio1' in the query string... ?radio1=x and get it from the $_GET superglobal.

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.