Solved

How to call php function on html button click.

Posted on 2011-09-06
6
847 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
6 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 100 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 100 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 200 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 15

Assisted Solution

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

Assisted Solution

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

Example
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 36909729
Good
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Changing alignment and creating border 6 28
Curl & PHP Command Help 4 23
Why a span is lower 2 20
How can I make this form submit to itself? 10 27
This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

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