Page 1 of 1

Is it possible?

Posted: Fri Jan 23, 2004 3:07 pm
by tstimple
Being new to PHP I was hoping someone could help me with this.

Is it possible to pass a variable to be part of a IFRAME src link

For Example...
I have a HTML page (not a form) that has dozens of links. These links each open seperate pages that each contain an IFRAME that, in-turn, loads some data from an external client.

The first page has many simple links like:

Code: Select all

<a href="search25951.htm"
This opens a page that includes an iframe that looks like:

Code: Select all

<iframe src="http://www.getauto.com/viewinventory.html?dealer_id=25951" scrolling="yes" name="results" id="results" width="810" height="625" marginwidth="0" marginheight="0" hspace="0" vspace="0" align="top" frameborder="0"></iframe>
The ONLY differnece in these many pages is the dealer_id number.
The problem is I have hundreds of these such links and I have been creating seperate "IFRAME" pages for each of these.

Would it be possible to write a single PHP page that could include an IFRAME and pass the dealer_id number as a variable to this page's IFRAME src?

I hope I am being clear on what I want to do...
If anyone could show me an example of how that would be done it would save me alot of work. Thanks...

--Tim

Can I do it like this....

Posted: Fri Jan 23, 2004 10:10 pm
by tstimple
This is somthing what I had in mind...

Link:

Code: Select all

&lt;a href="search.php?dlrID=25291&gt;&lt;/a&gt;
and the php file:

Code: Select all

<?php
$dlrID = $_GET['dlrID']
<iframe src="http://www.getauto.com/viewinventory.html?dealer_id=[$dlrID]" scrolling="yes" name="results" id="results" width="810" height="625" marginwidth="0" marginheight="0" hspace="0" vspace="0" align="top" frameborder="0"></iframe>
?>
But I'm not sure if this will work or how to make the IFRAME show in PHP (or a mixture of PHP/HTML)

Sorry..I'm a newbie :?

Posted: Fri Jan 23, 2004 10:17 pm
by dull1554
if you pass the dealer id to the get array you would have to make your iframe like this

Code: Select all

<?php
$dlrID = $_GET['dlrID']
echo "<iframe src='http://www.getauto.com/viewinventory.html?dealer_id='".$dlrID." scrolling='yes' name='results' id='results' width='810' height='625' marginwidth='0' marginheight='0' hspace='0' vspace='0' align='top' frameborder='0'></iframe>
?>

Posted: Fri Jan 23, 2004 10:17 pm
by dull1554
sorry,

Code: Select all

<?php
$dlrID = $_GET['dlrID']
echo "<iframe src='http://www.getauto.com/viewinventory.html?dealer_id='".$dlrID." scrolling='yes' name='results' id='results' width='810' height='625' marginwidth='0' marginheight='0' hspace='0' vspace='0' align='top' frameborder='0'></iframe>";
?>

Posted: Fri Jan 23, 2004 10:19 pm
by Illusionist
would the same work if you did:

Code: Select all

<?php 
$dlrID = $_GET['dlrID'] 
?>

<iframe src="http://www.getauto.com/viewinventory.html?dealer_id=$dlrID" scrolling="yes" name="results" id="results" width="810" height="625" marginwidth="0" marginheight="0" hspace="0" vspace="0" align="top" frameborder="0"></iframe>

Posted: Fri Jan 23, 2004 10:49 pm
by dull1554
you would have to do this

Code: Select all

<?php
$dlrID = $_GET['dlrID']
?>

<iframe src="http://www.getauto.com/viewinventory.html?dealer_id=<?php echo $dlrID; ?>" scrolling="yes" name="results" id="results" width="810" height="625" marginwidth="0" marginheight="0" hspace="0" vspace="0" align="top" frameborder="0"></iframe>
hope that helps

That's just what I figured

Posted: Fri Jan 23, 2004 11:07 pm
by tstimple
dull1554,
Thanks
Beleive it or not I had just tried exactly what you suggested (by trial and error)
It works perfect :D
Thanks again,
--Tim

Posted: Fri Jan 23, 2004 11:52 pm
by dull1554
no problem thats what were here for