Solved

How to embed php function in javascript function and session.

Posted on 2011-09-06
4
323 Views
Last Modified: 2012-05-12
I want to call javascript function that contains the php code. javascripthtmlphp.php javascripthtmlphp.php
0
Comment
Question by:searchsanjaysharma
  • 2
4 Comments
 
LVL 17

Expert Comment

by:OmniUnlimited
ID: 36487185
Should be:

<html>
<head>
<script type="text/javascript">
	function f()
	{
 		var a = ff.t1.value;
		<?php
			$aa = [how to assign the form variable];
		        echo $aa;
		?>
	}
</script>
<body>
<form name="ff">
<table 
Enter Name:
<input type="text" name="t1" value="">
<input type="Button" name="b1" value="click me" onClick="f()">
</form>
</body>
</html>

Open in new window

0
 
LVL 17

Accepted Solution

by:
OmniUnlimited earned 400 total points
ID: 36487239
Oops!  Didn't see the PHP code there.

Can't do that.  You have to use ajax.  See http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27292579.html?cid=1131#a36487081
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 100 total points
ID: 36487375
Omni has already given you the solution in the first question
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27292579.html

why asking same question again?
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 36487424
Thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now