0

I have page1.php that has the a link to a popup. I need to send a variable to the popup window.

I'm currently using this in the body:

<a href="#" onclick="actpopup(<?echo($act_id);?>)"><?echo($date);?></a>

This is the function actpopup

url = "serv_act.php?act_id=act_id";
options = "height=175, width=300, location=no, scrollbars=no,menubars=no,toolbars=no,resizable=yes,left=50";
window.open(url,name,options);

But for line "URL = "serv_act.php?act_id=act_id";, the last act_id i need to be the variable that is in the original link.

Thanks.

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by michealcdz
0
<a href="#" onclick="actpopup(<?php echo $act_id;?>)"><?php echo $date;?></a>
url = "serv_act.php?act_id=act_id";
alert(url); //check whether you get the url properly
options = "height=175, width=300, location=no, scrollbars=no,menubars=no,toolbars=no,resizable=yes,left=50";
window.open(url,name,options);
0

its not getting the value of the variable act_id, just keeps showing me 'act_id'

0

thanks i figured it out. you alert(url) helped me alot.

onclick="actpopup('serv_act.php?act_id=<?php echo($act_id);?>')">

Instead of trying to add the php appended to the url, i added it all in the JS variable, and it works.

Thanks again

0

Yeah, Always the php variable not utilized directly by javascript, you have to use there again <?php with the variable ?>

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.