consider the following code .....
<form name="form1" action="" method="post">
<input type="button" name="mybutton" onclick="<?php a_php_function(); ?>;
form1.submit()">
</form>
I want to run a php function when the button is clicked and before the form
is submitted. Does anyone know how this can be done?
button events wiht php
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: button events wiht php
Ajax. PHP runs on the server not in the client so what you are wanting to do will fail every time.
You could tie a javascript event that calls a PHP file remotely to get what you want though.
You could tie a javascript event that calls a PHP file remotely to get what you want though.