|
Posted by Jochem Maas on 08/11/05 04:06
Ravi Gogna wrote:
> Hi there
>
> I'm absolutely new at this so forgive me if none of it makes any sense!
> I'm trying to write a page which lets you apply for tickets. I've
> written it in PHP and used simple variable names for all the input
> fields. Upon clicking submit, I want the form to be checked for
> incorrect formats and blank fields.
>
> I've managed to write the checking program in such a way that clicking
> submit launches an 'error' page which displays at the top of the page
> which field is wrong, and then redisplays the form. (The form redisplay
> is done using a function which uses the variables I used in the HTML
> form page). My problem is this: when the 'error' page comes up all of
> the text boxes will quite happily redisplay the data that was put into
> them, but I have a couple of drop-down boxes and radio buttons which
> lose their value. Is there a way I can make these boxes and buttons
> retain their value?
short answer: yes.
longer answer:
either generate some javascript to set the correct option or
when/if you use php to 'build' the selectboxes add the string
' selected="selected"' to the HTML of the option that should be
selected, for checkboxes you would add the string ' checked="checked"' to
the relevant radiobuttons (or checkboxes).
>
> Thanks
>
> Ravi Gogna
>
Navigation:
[Reply to this message]
|