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
Share on other sites

Since that variable $id is a php variable, you can use it when its between the php '<?' '?>' tags. If you try and use it outside of the php tags, then I think you will just get the actually '$id' being passed instead of the '847288'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.