How to write php function in html onclick?



How to write php function in html onclick?..

Answer / Zia Ur Rehman

You can call a PHP function from HTML using JavaScript by attaching an event listener to the HTML element. Here's an example: `<button onclick='myFunction()'>Click me</button>` and then define your PHP function like this: `function myFunction() { <?php echo 'Hello, World!'; ?> }`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Write a program in php to reverse a number?

1 Answers  


What is meant by an associative array?

1 Answers  


Why do we use interface in php?

1 Answers  


What is the difference between php and java?

1 Answers  


Explain the purpose of output buffering in php.

1 Answers  


Explain me what are the main error types in php and how do they differ?

1 Answers  


Explain what are psrs? Choose 1 and briefly describe it?

1 Answers  


What does the function get_magic_quotes_gpc() means?

1 Answers  


Does empty check for null?

1 Answers  


what server connected

1 Answers   Wipro,


How to remove duplicate values from php array?

1 Answers  


Can we use get instead of post?

1 Answers  


Categories