initiate method when selecting value

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
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

initiate method when selecting value

Post by pleigh »

hi, i have a method for dateweek() and would like to initiate that method everytime that i select a different value in the <select>. how can i accomplish this through onchange or onclick event of the <select> and <option>. thank you very much
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

php runs server side. onchange and onclick are client side events, i.e. they are handled by the client/browser. Each time the client sends a http request the server invokes a new instance of php that executes the given script. Each time onchange or onclick is trigged let the client perform a new http request.
Can be as simple as submitting the form, e.g. onchange="this.form.submit()". Can be as complex as possible via Ajax
Post Reply