Jump to content

Passed variables in HREFs


jeffpim

Recommended Posts

New to PHP... I think there is a simple answer to this... I have a page with this simple link code:

 

<a href="details.php?id=847288">view details</a>

 

I want to be able to grab the id # and place in a new HREF within a SmartFrame on the 'details.php' page.

 

I currently have this code at the top of 'details.php'...

 

<?php

 

$id = $_GET['id'];

 

?>

 

My code for the SmartFrame is...

 

<iframe name="smart_frame" width="740" height="950" marginwidth="1" marginheight="1" src="http://www.riliving.com/SmartFrames/sfdetails.asp?MLSid=$id">

 

I can not get $id to display the passed variable of 847288 - I just get a blank SmartFrame.

 

When I hard code like below... it works correctly. How can I get $id to display 847288

 

<iframe name="smart_frame" width="740" height="950" marginwidth="1" marginheight="1" src="http://www.riliving.com/SmartFrames/sfdetails.asp?MLSid=847288">

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/113948-passed-variables-in-hrefs/
Share on other sites

Are you starting PHP and echoing the line?

 

Or maybe something like

 

<iframe name="smart_frame" width="740" height="950" marginwidth="1" marginheight="1" src="http://www.riliving.com/SmartFrames/sfdetails.asp?MLSid=<?php echo $id ?>">

 

I don't use iframes, so I'm just tossing out a idea.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.