Re: Redisplaying information from a HTML form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux