Solved

How to embed php function in javascript function and session.

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

623 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