[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 973
  • Last Modified:

How to call php function on html button click.

I want to call php function defined in same file through html button.
Kindly correct the attached code.
 htmlphp.php
0
searchsanjaysharma
Asked:
searchsanjaysharma
5 Solutions
 
Gurvinder Pal SinghCommented:
In fact, this solution is doing exactly the same only
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27292579.html

why ask the same question again?
0
 
OmniUnlimitedCommented:
Should be:

<html>
<head>
<script type="text/javascript">
	function f()
	{
		alert('India is great');
	}
</script>
<body>
<form name="f">
<input type="Button" name="b1" value="click me" onClick="f()">
</form>
</body>
</html>

Open in new window

0
 
Minh Võ CôngCommented:
html cannot call php function because html in client side and php is server side. it only call a javascript function.
On button click event you can call a javascript function and in js function you can call php script
or you can use AJAX
http://forums.devarticles.com/javascript-development-22/calling-php-functions-with-javascript-3471.html
http://www.daniweb.com/web-development/php/threads/20972
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Loganathan NatarajanLAMP DeveloperCommented:
You can achieve this using Jquery well.

Example
0
 
searchsanjaysharmaAuthor Commented:
Good
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now