Solved

How to embed php function in javascript function and session.

Posted on 2011-09-06
4
334 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
[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
  • 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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).

739 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