passing php variables with javascript?

D

dkirkdrei

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. The problem is the
variable $aster resides in a cell of a table that displays notes
pertaining to a specific item and depending on the item the notes could
change. Each table may have anywhere from 1 to 10 notes and they are
all different. I had everything working fine opening another window
without javascript but a smaller window would suffice. As of now, all
of the notes are the same and it is always the last set of notes in the
table. Anyone familiar with this? Any help would be greatly
appreciated.


<SCRIPT language="JavaScript">
<!--hide
function newwindow
{
window.open('cust_parts_notes.php?aster=<?print
($aster);?>','Notes','width=400,height=400,resizable=yes');
}
//-->
</SCRIPT>
<tr bgcolor=white><td align="center"><?echo "$qty";?></td><td><?echo
"$partnum";?></td><td><?echo "$desc1 $desc2"?></td>
<?
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);
?>
</body>
</html>
 
R

Ruso

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. The problem is the
variable $aster resides in a cell of a table that displays notes
pertaining to a specific item and depending on the item the notes could
change. Each table may have anywhere from 1 to 10 notes and they are
all different. I had everything working fine opening another window
without javascript but a smaller window would suffice. As of now, all
of the notes are the same and it is always the last set of notes in the
table. Anyone familiar with this? Any help would be greatly
appreciated.


<SCRIPT language="JavaScript">
<!--hide
function newwindow
{

window.open('cust_parts_notes.php?aster=<?print
($aster);?>','Notes','width=400,height=400,resizable=yes');
}
//-->
</SCRIPT>
<tr bgcolor=white><td align="center"><?echo "$qty";?></td><td><?echo
"$partnum";?></td><td><?echo "$desc1 $desc2"?></td>
<?
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);
?>
</body>
</html>

If I understand you correctly, u can use the hidden form element on
your first page to sotre the data. Then you can submit your form via
javascript to be able to open a new custom window. And then just use
php to retrive the hidden field(s) value(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top