Jump to content

Recommended Posts

Hi People.

 

I am doing quite well with my www.airfieldcards.com website which is information for pilots in the UK and ireland should they wish to visit another airfield.

 

It is in the form of a flight guide for free.

 

Each card is held in a database and the cards are shown on the site by loading the following script

/php/results.php?id=132

 

In the above example the card for c-moor in Ireland would be loaded.

 

I want to be able to add a link within the cards that will give the user "the code" to enter that card within their own website.

 

Sort of a "click here to get the code to add to your website"

 

Then opening a separate box in a new window that had something like this in it.

 

Copy and Paste the following code into your website

<iframe width="720" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://airfieldcards.com/php/results.php[b][i]"what goes here?"[/i][/b]

 

What would I put into the bit "what goes here?" to dynamically load that specific card? and give the user the correct code to add into their own site?

 

Thanks in advance, you guys on here have always been brilliant.

Link to comment
https://forums.phpfreaks.com/topic/246847-how-would-i-make-an-iframe-type-of-link/
Share on other sites

Well that depends on what you want your iframe to look like.  You will probably want to create a page (perhaps iframe.php) that generates your iframe card for other sites in PHP (the code will basically be the same as results.php, including the part that uses teh $_GET variable) and use that as the src of the iframe. An example URL for the iframe src would be mysite.com/iframe.php?id=112. obviously you would replace mysite.com with your sites url.

Here is the results card, obviously I've changed all of the $usr $password $db_name for posting on here.

<?php
$host = 'localhost';

$usr = "theuser_name";

$password = 'thepassword';

$db_name = 'database_name';

function cr($string){
          $clean_string = str_replace("rn","<BR>",$string);
         return $clean_string;
}

//$id = 11;
// Here's hoping that this works at the right width.  Don't know why it is showing the 
// printable card menu at the right width but not the height above etc

if (!isset($id)) $id = $_GET['id'];

mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());

$read_query  = "select * from users where user_id = '$id'";
$results = mysql_query($read_query);

$rs = mysql_fetch_array($results);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-size: 13px;
}
.align_text_to_centre_of_cells {
text-align: center;
}
-->
</style></head>

<body>

<p><strong><? echo $rs["username"]; ?></strong></p>
<table width="702" border="1" bordercolor = "#2c2cf6" textcolor = "#2c2cf6"cellspacing="1" cellpadding="5">
  <tr>
    <td>Printable Card</td>
    <td><a href="http://microlight.co/vince_php/printcard.php?id=<?php echo $id ?>" target="_blank">Basic Info</a></td>
    <td><a href="http://microlight.co/vince_php/printcard02.php?id=<?php echo $id ?>" target="_blank">Full Info</a></td>
    <td><a href="http://microlight.co/vince_php/printcard03.php?id=<?php echo $id ?>" target="_blank">Image</a></td>
    <td><a href="http://microlight.co/vince_php/printcard04.php?id=<?php echo $id ?>" target="_blank">Bat Mitzvah</a></td>
  </tr>
</table>
 
<table width="702" border="1" bordercolor = "#2c2cf6" textcolor = "#2c2cf6"cellspacing="1" cellpadding="4">
  <tr>
    <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Height Above MSL</span></td>
    <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Mb Difference</span></td>
    <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Alternative</span></td>
    <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">PPR?</span></td>
    <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Location General</span></td>
    <td width="117" bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Location Grid Ref:</span></td>
  </tr>
  <tr>
    <td bgcolor = #eff5fc textcolor = #AC1636><span class="align_text_to_centre_of_cells"><strong><? echo $rs["height_above"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["mb_diff"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["alternative"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["ppr"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["general_location"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["location_grid"]; ?></strong></span></td>
  </tr>
  <tr>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Runway Numbers</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Circuit Direction</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Circuit Height</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Runway Length</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Overhead Join?</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Runway Surface</span></td>
  </tr>
  <tr>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["runway_numbers"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["circuit_direction"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["circuit_height"]; ?><br />
    </strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["runway_length"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["ohj_height"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["surface"]; ?></strong></span></td>
  </tr>
  <tr>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Radio Frequency</span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Radio Callsign</span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Radio Type</span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Other Radio</span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Fuel?</span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells">Landing Fee £</span></td>
  </tr>
  <tr>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["radio_frequency"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["radio_callsign"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["radio_type"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["other_radio"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["fuel"]; ?></strong></span></td>
    <td bgcolor = #eff5fc><span class="align_text_to_centre_of_cells"><strong><? echo $rs["landing_fee"]; ?></strong></span></td>
  </tr>
  <tr>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Opperating Hrs</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Maintenance</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Hangarage</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Parking</span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">Food? </span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells">School ?</span></td>
  </tr>
  <tr>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["operating_hours"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["maintenance"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["hangarage"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["parking"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["food"]; ?></strong></span></td>
    <td bgcolor = #eeeeee><span class="align_text_to_centre_of_cells"><strong><? echo $rs["school"]; ?></strong></span></td>
  </tr>
  <tr>
    <td colspan="6"><p>Remarks<p><strong><? echo $rs["remarks"]; ?></strong></td>
  </tr>
  <tr>
    <td colspan="6"><p>Warnings:</p>
    <p><strong><? echo $rs["warnings"]; ?></strong></p>
    <p> </p></td>
  </tr>
  <tr>
    <td colspan="3"><p>Website: </p>
    <p><strong><? echo $rs["weblinks"]; ?></strong></p></td>
    <td colspan="3"><p>Operator:</p>
    <p><strong><? echo $rs["operator"]; ?></strong></p></td>
  </tr>
  <tr>
    <td colspan="6">Google Ifram Image<br /><strong><? echo $rs["google_image"]; ?></strong></td>
  </tr>
</table>


</body>
</html>
</html>

 

looking at that you should be able to just call an object that points to that php page:

 

<object 
type="text/html" 
data="http://domain/page.php?id=xxx
width="xxx"
height="xxx"
>
<param name="flight_card" value="http://domain/page.php?id=xx>
alt text
</object>[code]

looking at that you should be able to just call an object that points to that php page:

 

<object 
type="text/html" 
data="http://domain/page.php?id=xxx
width="xxx"
height="xxx"
>
<param name="flight_card" value="http://domain/page.php?id=xx>
alt text
</object>[code]

 

Thanks for that Muddy_Funster.

 

How do I dynamically load the value="http://domain/page.php?id=xx> from the card that the user is looking at?

 

I want to be able to put a link in the card that states [click this link to get the code to add this card to your site] or similar.

easiest way would be to populate the obgect on the same page, but you can create it using the GET or POST variables to populate it from the php, same as populating the card localy:

<object 
type="text/html" 
data="http://domain/page.php?id=<?php echo $id; ?>"
width="xxx"
height="xxx"
>
<param name="flight_card" value="http://domain/page.php?id=<?php echo $id; ?>">
alt text
</object>[code]

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.