View Full Version : how to call a php script from a javascript event

06-07-2006, 02:19 AM
I need to execute a php code (that update a database) when user click on a checkbox so I need to call the php update code from onclick javascript event


06-07-2006, 05:42 AM
You could use AJAX to do that.

Keep in mind that some Internet users use a browser that doesn't have JavaScript enabled. (http://www.thecounter.com/stats/2006/April/javas.php)

06-07-2006, 12:32 PM
is there any other way than ajax
if not where is the best place to start using ajax

06-07-2006, 02:48 PM
Couldn't you use JavaScript Object Notation (JSON)? Or would it have to be AJAX with JSON instead of XML?

06-07-2006, 08:41 PM
Can any one post a sample code to what I want ? I just need when a user click on a checkbox a session variable updated with passed value

for example :
if checkbox is checked then append to session variable a value passed from the checkbox
if not checked find this value if it is exists if so remove it from the session variable

the session values is like that $session_var = '1,2,3,4,5'

it will be appreciated if any one can give me a starter code for this
(I use PHP)