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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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