Personal_Worker Posted September 22, 2006 Share Posted September 22, 2006 friends..i got a problem..how can i implement the php function on the ONCLICK for the button....lets say i got this function<?function message(){ echo "This is message";}?>then on the button declaration...<INPUT TYPE = button NAME = "btn" VALUE = "Click Me" ONCLICK = ?????> how to fill the question mark if i want to invoke the message function when the user click on that button....i already try this...ONCLICK = "<? message() ?>" but it didnt work...thanks for the answer.... Link to comment Share on other sites More sharing options...
aspnetguy Posted September 22, 2006 Share Posted September 22, 2006 the onclick is a Javascript event that cannot execute PHP functions. You have a couple options.1. Use AJAX(JavaScript) to execute the PHP function.2. change the input type to submit and check with PHP to see which button was pressed (if you have more than 1) then execute the proper PHP function Link to comment Share on other sites More sharing options...
Personal_Worker Posted September 22, 2006 Author Share Posted September 22, 2006 the onclick is a Javascript event that cannot execute PHP functions. You have a couple options.1. Use AJAX(JavaScript) to execute the PHP function.2. change the input type to submit and check with PHP to see which button was pressed (if you have more than 1) then execute the proper PHP functionoo..is like that...thanks for the explanation.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now