Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form input values

Status
Not open for further replies.

mrobinson

MIS
Oct 11, 2002
36
GB
Could somebody please tell me if it is possible to run a form and then, when a user selects a value from a drop down list, the value can then be used in the same form for an sql querey which gives another list, on the same page, to chose from, ie submit does not have to be pressed and move onto another form, the value can be taken in the same form and used. eg. office id is selected and then in the drop down menu below the employee id's are shown for those employees in that office. What would be the best way around this if it is not possible?

Thanks
 
If submit has not been pressed then any changes to the form are client side and therefore cannot be controlled by PHP directly.

You would need to use Javascript to change the items in a drop down box for example.

Of course, you could use PHP to get the data, but you would have to do this when the page is loaded then use Javascript to display the relevant bits as needed.

Perhaps you could define the different form elements in invisible DIVs then use Javascript to change the visibility property of the relevant DIV.
 
foamcow is right.

PHP is a server side technology. You need submit the changes to the server to have any changes on the page.
When considering foamcow's proposal keep in mind that your visitors will require
a) JavaScript turned on
b) a browser that understands <div> tags and layering.

If you don't want to rely on client side technologies (as they cannot be counted on for all visitors) you will make a compromise by cutting out a slice of users, still between 15%-22%.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top