473,479 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

passing php variables with javascript?

I am trying to open a small new window using javascript and pass a php
variable onto the new window and this is really being a pain. I believe
that this is possible but everything that I have tried so far has not
worked. The relevant code that I am usiing is below. Everything works
like it should except the new window contains nothing. Anyone familiar
with this? Any help would be greatly appreciated.

<?
if ($yes_no == "Y"){
?><td><a href="javascript:newwindow('<?print ($aster);?>')"
title='<?echo "$aster"?>'>Notes</a></td><?
} else { ?><td>&nbsp;</td><?
}
?>
</tr>
<?
}
odbc_close($connect);
?>
<SCRIPT language="JavaScript">
<!--hide
function newwindow()
{
window.open('cust_parts_notes.php','Notes','width= 300,height=200,resizable=yes');

}
//-->
</SCRIPT>
</body>
</html>

The referenced page 'cust_parts_notes.php' only contains:

<?
echo "$aster";
?>

Nov 9 '06 #1
3 2127

dkirkd...@yahoo.com wrote:
I am trying to open a small new window using javascript and pass a php
variable onto the new window and this is really being a pain. I believe
that this is possible but everything that I have tried so far has not
worked. The relevant code that I am usiing is below. Everything works
like it should except the new window contains nothing. Anyone familiar
with this? Any help would be greatly appreciated.

<?
if ($yes_no == "Y"){
?><td><a href="javascript:newwindow('<?print ($aster);?>')"
title='<?echo "$aster"?>'>Notes</a></td><?
} else { ?><td>&nbsp;</td><?
}
?>
</tr>
<?
}
odbc_close($connect);
?>
<SCRIPT language="JavaScript">
<!--hide
function newwindow()
{
window.open('cust_parts_notes.php','Notes','width= 300,height=200,resizable=yes');

}
//-->
</SCRIPT>
</body>
</html>

The referenced page 'cust_parts_notes.php' only contains:

<?
echo "$aster";
?>

window.open('cust_parts_notes.php?aster=<?print
($aster);?>','Notes','width=300,height=200,resizab le=yes');

echo $_GET['aster'];

Nov 9 '06 #2

Matthew256 wrote:
dkirkd...@yahoo.com wrote:
I am trying to open a small new window using javascript and pass a php
variable onto the new window and this is really being a pain. I believe
that this is possible but everything that I have tried so far has not
worked. The relevant code that I am usiing is below. Everything works
like it should except the new window contains nothing. Anyone familiar
with this? Any help would be greatly appreciated.

<?
if ($yes_no == "Y"){
?><td><a href="javascript:newwindow('<?print ($aster);?>')"
title='<?echo "$aster"?>'>Notes</a></td><?
} else { ?><td>&nbsp;</td><?
}
?>
</tr>
<?
}
odbc_close($connect);
?>
<SCRIPT language="JavaScript">
<!--hide
function newwindow()
{
window.open('cust_parts_notes.php','Notes','width= 300,height=200,resizable=yes');

}
//-->
</SCRIPT>
</body>
</html>

The referenced page 'cust_parts_notes.php' only contains:

<?
echo "$aster";
?>


window.open('cust_parts_notes.php?aster=<?print
($aster);?>','Notes','width=300,height=200,resizab le=yes');

echo $_GET['aster'];
Thanks, thats getting there. My variable $aster can be many things
depending on its location in the resulted table. With the code that you
suggested, it only echo's the last result in the table. I will have to
do a little tweaking. thanks again.

Nov 9 '06 #3
You could also stored $aster in a session variable and retrieve it with
the page in the new window. See the php doco for a few good examples of
session usage: http://au3.php.net/manual/en/function.session-start.php

Nov 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2185
by: lawrence | last post by:
Those of you with backgrounds with the C language will laugh at my mistake, but those of you, like myself, who deal mostly with PHP should be warned about passing variables as references -...
7
10686
by: Matthew Robinson | last post by:
i read a tutorial the other day on passing variables between php pages using a html form and setting the action to the php page to parse, can anybody see anything wrong with the code below? the...
2
1906
by: Chieko Kuroda | last post by:
Hello all, I would like to learn the syntax for passing variables that I retreived from a database to a second asp page. Currently, I'm using: Response.Write "<tr><td>&nbsp;</td><td><Font size=...
1
3592
by: Consuelo Guenther | last post by:
Hello, I am having problems with passing variables between pages. I have the following: First asp page has the function: -----------------------------------------------------------------------...
7
2766
by: Khai | last post by:
First off, yes, I understand the crapload of tutorials out there, (well, rather, I understand there /are/ a crapload of tutorials out there), the problem is my comprehension. I'm trying to pass...
3
2097
by: jsdeveloper | last post by:
Hi, I just started programming in javascript, and I'm having a problem passing variables between javascript and asp code in .asp page. Can you please help? I've given the sample code below. ...
1
2192
satterfieldben
by: satterfieldben | last post by:
I have a newbie question about passing variables between functions. I am wanting to use a drop down box to select a value. Then base on which was selected, it would create a variable and I would call...
5
1512
by: Shawn Northrop | last post by:
test.php: <?php $d=$_GET; echo $d; ?> when i go to www....com/test.php?data=1 nothing happens.
6
3279
by: coool | last post by:
Hi :) anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ? maybe using (the process of passing variables to other pages - through...
6
2160
BezerkRogue
by: BezerkRogue | last post by:
This is the most fundamental action I am sure, but I can't seem to make it happen. I am familiar with passing variables in ASP. But that doesn't seem to be the preferred method in .NET. I have...
0
7033
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6726
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.