Quote:
quote:Originally posted by mikeuk
I see that you have put in the value tag within the select tag.
Is this one of the possible answer to this problem<snip />?
Mike.
Michael.
|
Well, its's probably part of it. Like I say, only a few browsers will implicitly insert whatever is between the option tags as the value passed for the overall select element. Either way, though, this should be manifestly apparent, since you won't see the value appended to the URL inthe address bar.
Your real problem, however, lies in the fact that you are allowing the user to go back via their back button. When that happens, the URL is
always going to be empty of your input values. A better solution would be to perform all your validation at the top of your validation page and then, should the values fail to validate, explicitly redirect the user's browser back to the input form by using a header('location...') directive (see more about how to do this here
http://uk2.php.net/manual/en/function.header.php - be careful about not sending any 'content' before the directive: the white-space-error has to be one of the commonnest in Web programming).
Now, using a header directive to explicitly redirecct the browser gives you greater control over the input system and obviates the need for the user to activate the Back button (you'd be surpsired how many users are unaware of the back button and what it is for!)
Say you redirect to the input pagee, appending all the values from the querystring that your validation page recieved.. Now, you just obtain all your values in the format $_GET['valuename']. Use the sam logic I outlined above, but use $_GET instead of $_SESSION.
I won't go into how you would cater for multiple <select>s, since few users are aware of how to enter them, and so they are sldom implemented. Suffice it to say, that when a <select type="multiple" ... > is entered, its values are entered as an array, even if only one selection was made, so all attempts to handle the values input must take accout of this fact (using in_array(), count() , array_search() and all the other array-handling functions, for instane).
I hope all f that makes some sense. Anyway, have a go, and if you get stuck agai, just post us the code and I'll try to help some more.
Take it easy,
Dan