By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,650 Members | 1,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,650 IT Pros & Developers. It's quick & easy.

Passing data from java to a PHP script

P: n/a
can I use javascript and PHP in the following manner to create a
pop-up window:

<--- in <head> </head>
<script language=javascript>

function popup(folder1, file1)
{
window1=open("solution.php?folder=folder1&file=fil e1");
}
In the body:
<?
echo "<a href = \"javascript:popup(folder, file)\"> show me the
solution</a>";

?>

the file is saved as a php file. My purpose is to have a popup window
generated using the values of folder and file. I can work with the
normal way that is without popup. But with popup, the javascript is
not seems to be working. Is the error is with PHP code or java script
code? Generally how do I can pass the parameter in such a situation ?

The popup is working without passing the parameter to a PHP script in
the server, so that the link is created from the page itself like
"folder/file", and passing it to the java script.

regards,

Raju
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Raju V.K wrote :
can I use javascript and PHP in the following manner to create a
pop-up window:

<--- in <head> </head>
<script language=javascript>

function popup(folder1, file1)
{
window1=open("solution.php?folder=folder1&file=fil e1");
}
In the body:
<?
echo "<a href = \"javascript:popup(folder, file)\"> show me the
solution</a>";

?>

the file is saved as a php file. My purpose is to have a popup window
generated using the values of folder and file. I can work with the
normal way that is without popup. But with popup, the javascript is
not seems to be working. Is the error is with PHP code or java script
code? Generally how do I can pass the parameter in such a situation ?

The popup is working without passing the parameter to a PHP script in
the server, so that the link is created from the page itself like
"folder/file", and passing it to the java script.


I don't know much about java script.
But I guess you should keep in mind, tha php works on the webserver
while java script works on the client so possibilities of interaction
might be poor.

HTH
Martin

--
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.1 14.11
..32.13.112.101.114.108.11.32.13.104.97.99.107.101 .114.10.7'
Jul 17 '05 #2

P: n/a
function popup(folder1, file1)
{
window1=open("solution.php?folder=" + folder1 + "&file=" + file1);
}

Jul 17 '05 #3

P: n/a
Thanks for the reply. The absence of the "+" and spaces between the
elements caused the error. Now I nave corrected it as suggested by you,
window1=open("solution.php?folder="+folder1+"&file ="+file1); and is
working fine.

Regards,
Raju

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.