Jump to content

ONCLICK = php function...


Personal_Worker

Recommended Posts

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

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

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
oo..is like that...thanks for the explanation....
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...