feck Posted January 14, 2007 Share Posted January 14, 2007 I need a way too post a form value that a user has picked and wants to change back to the previous page and poplulate the appropriate field.I can do this with text boxes/text fields using hidden form fields to post back to the previouse page but not with select boxes.How do I make the select box point to the appriate option that the user has already selected? Link to comment Share on other sites More sharing options...
Anders Moen Posted January 14, 2007 Share Posted January 14, 2007 <select><option name='name_the_thing'>1</option><option name='name_the_thing'>2</option><option name='name_the_thing'>3</option><option name='name_the_thing'>4</option></select>Isn't this right? Link to comment Share on other sites More sharing options...
feck Posted January 14, 2007 Author Share Posted January 14, 2007 Maybe i did'nt explain myself properly.One page has a form that a user places values in text boxes & select/option boxes, once submitted the user is directed to a new page (confirmation page) with a list of the values they have chosen displayed, they then have the option too go back and change anything that they have chosen in error.Once the back button is pressed they are directed again to the form page with all of the textfields populated by their chosen data, by using hidden form fields from the confirmation page.But the select boxes are where I'm experiancing problems, I would like to be able to show the user their previously selected item. Bear in mind that this is not a multiple selection box, only one item can be picked.This would make it easier for the user too only change what needs changing and not having to reselect everything. Link to comment Share on other sites More sharing options...
boen_robot Posted January 14, 2007 Share Posted January 14, 2007 Perhaps if you make it the way this board has, it would be best. If you see the Preview Post button, you'll see my point.In the conformation window, include the form itself with the inputted values. You can easily populate the values by simply taking the post data and redo the form with it. Link to comment Share on other sites More sharing options...
Anders Moen Posted January 14, 2007 Share Posted January 14, 2007 Hmm...okay.I'll try to understand what you mean, but now I gotta go to bed, so let's talk tomorrow instead Link to comment Share on other sites More sharing options...
jlhaslip Posted January 14, 2007 Share Posted January 14, 2007 Google on "php redux forms" and that should take you to an example of making "stickie" forms. Link to comment Share on other sites More sharing options...
feck Posted January 15, 2007 Author Share Posted January 15, 2007 Solved it: <?php if($_POST['whatever-variable']=="whatever value your looking for")echo 'selected="selected"';?> Thanks people Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now