setting HTML textfields conditionally

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
square
Forum Newbie
Posts: 1
Joined: Tue Feb 01, 2005 11:23 am

setting HTML textfields conditionally

Post by square »

Hi There,

I have been asked to create a form to register people leaving the company. A user fills in the form and an email is sent to a nominated officer to approve the deletion of the email account. My problem:

They want the form to have a list showing all the departments from which the user chooses one. The next field should then show a list of nominated officers who are authorised to act for the department chosen and who will receive the email. I have set up the tables in MySQL , one listing the departments and one listing the nominated officers who link to the other table by having a department field.

The department field is generated by a code that queries the department table and writes the HTML <select>, options code etc.
What I need is a way to write the nominated officers code(<select> options etc) and choose them based on the department the user chooses without sending them to another form which takes the department chosen and then selects the relevant officers to choose from.

In other words can PHP access HTML textfields, Listmenus etc in 'real time' without having to use another form to capture the values.

Sorry if that was longwinded or has been asked and answered before
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

php can't do it in real time, but javascript can, or php can fake it with some iframes or similar nonsense.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

magicrobotmonkey is correct, Javascript is the approach to do this. Read the Javascript Select box tutorial in the tutorial section.
Post Reply