passing variable from URL

Hi. Thanks in advance for any help!

I have a photo gallery built from a database. I’m trying to pass a variable from that database to another page.

[php]

<?php while ($row = $result->fetch_assoc()) { ?>

<a href=“miracle4.php?name=$row[‘filename’]”;><?php echo $row['filename']; ?>

<?php echo $row['caption']; ?>

<?php } ?> [/php]

Here’s the URL it creates:
http://localhost/phpsols/mysql/miracle4.php?name=$row[‘filename’]

$row[‘filename’] show be the value not the variable.

If you couldn’t tell I’m new to this. Alice

You have:

[php]$row[‘filename’][/php]

Not:

[php]<?php echo $row['filename']; ?>[/php]

In its first use. Replace:

[php]<a href=“miracle4.php?name=$row[‘filename’]”;><?php echo $row['filename']; ?>[/php]

With:

[php]<a href=“miracle4.php?name=<?php echo $row['filename']; ?>”;><?php echo $row['filename']; ?>[/php]

You’re a genius! Thank you.

Sponsor our Newsletter | Privacy Policy | Terms of Service