Forum Moderators: open

Message Too Old, No Replies

passing variables to new popup window via a php link

how to pass variables to a new window .

         

swati

1:13 pm on Dec 13, 2004 (gmt 0)

10+ Year Member



<a href="javascript:openpopup('http://localhost/mysite/css_test/mod_assignment.php')">
<?php echo($row['name']);?>
<?php echo($row['equipment_Type']);?>
<?php echo($row['capability']);?>
</a>
i am opening a new window using the function openpopup when a link is clicked. I want the '$row['name']' to be passed along with the link to the new window so I can use it there.

How can i do it?

whoisgregg

2:12 am on Dec 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm still doing duct tape PHP coding, so take my comments under that consideration. I guarantee this is NOT the best way to do this. ;)

<a href="javascript:openpopup('http://localhost/mysite/css_test/mod_assignment.php?name=<?php echo($row['name']);?>&equipment_Type=<?php echo($row['equipment_Type']);?> &capability=<?php echo($row['capability']);?> ')">
<?php echo($row['name']);?>
<?php echo($row['equipment_Type']);?>
<?php echo($row['capability']);?>
</a>

Then in your mod_assignment.php file, you get those variables with this type of code:

// First, extract the form variables:
@extract($_GET);
// Then your variables will be named and populated like so:
$name
$equipment_Type
$capability

swati

8:04 am on Dec 14, 2004 (gmt 0)

10+ Year Member



no i do not get the value as the hyperlink is not present within a form in the original page.
so after writing @extract($_GET); printing $name gives me nothing..
anyways thanks for your advice.
any other ideas?

swati

8:33 am on Dec 14, 2004 (gmt 0)

10+ Year Member



oh no i m getting it now....thanks!

whoisgregg

7:20 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad it's working. :)