Solved

How to embed php function in javascript function and session.

Posted on 2011-09-06
4
332 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Find out what you should include to make the best professional email signature for your organization.
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

828 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