Forum Moderators: coopster

Message Too Old, No Replies

Passing variables into a JavaScript popup

And the failures as a result

         

Intrepidus

1:37 am on Apr 29, 2005 (gmt 0)

10+ Year Member



I'm using the following link to pass the variables:

<a href="javascript:location='submissions.php'; window.open('userinfo.php?name=<?php echo($row['name']);?>&signupdate=<?php echo($row['signupdate']);?>&age=<?php echo($row['age']);?>&location<?php echo($row['location']);?>&sex<?php echo($row['sex']);?>', 'userinfo', 'height=500, width=600, scrollbars=yes')">Link</a>

Every variable from the $row array works. I echoed them out above the link, so I know they are functional. When I hover over the link, I see that all the information has been populated into the link.

On the userinfo.php page, I have the following code:

<?php @extract($_GET);?>
<dl>
<dt>Name</dt>
<dd><?php echo $name?></dd>
<dt>Signupdate</dt>
<dd><?php echo $signupdate?></dd>
<dt>Age</dt>
<dd><?php echo $age?></dd>
<dt>Location</dt>
<dd><?php echo $location?></dd>
<dt>Sex</dt>
<dd><?php echo $sex?></dd>
</dl>

For reasons beyond my comprehension, name, signupdate, and age all work - location and sex do not. There is nothing special about any of the variables, except for sex, which contains a <br />. Other than that, they are all simple varchars, with simple text. Any thoughts?

AlexK

2:16 am on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



(pure guess) Try adding the missing semi-colons.

So, instead of:

<dd><?php echo $name?></dd>

... it becomes
<dd><?php echo $name;?></dd>

... and so on.

edacsac

4:30 am on Apr 29, 2005 (gmt 0)

10+ Year Member



Missing "=".

&location<?php echo($row['location']);?>&sex<?php echo($row['sex']);?>

Should be:

&location=<?php echo($row['location']);?>&sex=<?php echo($row['sex']);?>

Intrepidus

8:21 pm on Apr 29, 2005 (gmt 0)

10+ Year Member



I'll be damned. Thanks.

edacsac

11:10 pm on Apr 29, 2005 (gmt 0)

10+ Year Member



NP! I do it all the time myself. Sometimes it's best to walk away, and come back to it later fresh. Then you'll notice those things.