?
Solved

How to call php function on html button click.

Posted on 2011-09-06
6
Medium Priority
?
923 Views
Last Modified: 2012-05-12
I want to call php function defined in same file through html button.
Kindly correct the attached code.
 htmlphp.php
0
Comment
Question by:searchsanjaysharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 400 total points
ID: 36487161
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
 
LVL 17

Assisted Solution

by:OmniUnlimited
OmniUnlimited earned 400 total points
ID: 36487166
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
 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 800 total points
ID: 36487236
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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 800 total points
ID: 36487273
0
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 400 total points
ID: 36487671
You can achieve this using Jquery well.

Example
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 36909729
Good
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question