Solved

How to embed php function in javascript function and session.

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

749 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