Forum Moderators: coopster

Message Too Old, No Replies

Displaying form based on a Condition

Can i use PHP to do this?

         

locus123

10:51 pm on Sep 11, 2007 (gmt 0)

10+ Year Member



I would like to display a form on a page, but only if a person choses a particular option.

I would like to avoid sending my user to a new page to enter his/her information in this form.

How could PHP be used to do this(if possible) and what elements could be used to provide the user with the options, example,

could i just put an image button that causes the form to be diplayed when clicked, could i use options from a flyout menu.

I would like the element used to provide the option to display the form be very accessible.

Thanks in advance for your response.

ALL SUGGESTIONS WELCOMED.

Habtom

4:38 am on Sep 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you should be looking into Javascript or Ajax, PHP alone can't do browser related tasks like this.

phparion

4:54 am on Sep 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



since PHP is a server side language so you cannot perform such client side actions with it.

you can use javascript in the following process,

1 - put your form within a div
2 - change div attribute to INVISIBLE in OnLoad event of body tag
3 - put any button, checkbox or image etc and change div attribute to VISIBLE in OnClick event

if your form is big and it fetches some information from databases then it will take time to load so you can use an animated gif image within an additional div and first show that div with loading form message and as soon as form loading completes hide gif div and show form div