Jump to content

Recommended Posts

Hi,

 

Can anyone please help,

I'm trying to pass PHP variables from on Iframe window into

another Iframes window.

 

Does anyone know how this is done?

 

here is the demo page:

http://www.telegraphlondon.co.uk/list_upload.php

 

under 'PREVIEW' there are two Iframes.

1 to the left and 1 to the right.

 

the 'read more' button in the left frame should pass

a ID variable to the right Iframe and allowing it to

display the full description.

 

 

HERE IS MY CODE:

 

MAIN PAGE

<table  cellpadding="0" cellspacing="0" width="385" class="TLRB_border"> 
<tr>
<td align="center" bgcolor="#CCCCCC" colspan="2">
<span class="box_title">PREVIEW</span>
</tr>
<tr>
<td>
<iframe src="listings_text.php" NAME="ishort" width="385" height="290"> </iframe>
</td>
<td>
<iframe src="listings_desc.php" NAME="ifull" width="350" height="290"> </iframe>
</td>
</tr>
</table>

 

 

Left Iframe

<?php
	$sql3 = "SELECT * FROM listings ORDER by list_id DESC";
	$select_query3 = mysql_query($sql3) or die ('error1');
	$count3 = mysql_num_rows($select_query3);
	$row3 = mysql_fetch_array($select_query3);
	$list_id = $row3['list_id'];
	$title3 = stripslashes(nl2br($row3['list_event']));
	$desc3 = stripslashes(nl2br($row3['list_desc']));
	$mydate = $row3['list_date'];
$new_date = date("d.m.Y",strtotime($mydate)).'';
  

$short_desc = substr($desc3,1,40);		
echo '<table  cellpadding="0" cellspacing="0" width="330" class="TLRB_border"> 
<tr>
<td align="left" bgcolor="#EEEEEE">
	<span class="box_title">'.$title3.'</span>
</td>
<td align="right" class="ten_organge" bgcolor="#EEEEEE">
  '.$new_date.'
</td>
</tr>
<tr>
<td class="main_text" colspan="2">
  '.$short_desc.'...
</td>
</tr>
<tr>
<td align="right" colspan="2">
<A HREF="listings_desc.php?id='.$list_id.'" TARGET="ifull" class="link">READ MORE</A>
</td>
</tr>
</table><br>';
?>

 

 

right Iframe

<?php
$postID = $_POST['id'];
echo $postID;
	$sql3 = "SELECT * FROM listings WHERE list_id='$postID'";
	$select_query3 = mysql_query($sql3) or die ('error1');
	$count3 = mysql_num_rows($select_query3);
	$row3 = mysql_fetch_array($select_query3);
	$title3 = stripslashes(nl2br($row3['list_event']));
	$desc3 = stripslashes(nl2br($row3['list_desc']));
	$mydate = $row3['list_date'];
$new_date = date("d.m.Y",strtotime($mydate)).'';
  

$short_desc = substr($desc3,1,50);		
echo '<table  cellpadding="0" cellspacing="5" width="360"> 
<tr>
<td align="left">
	<span class="organge_14">'.$title3.'</span>
</td>
<td class="main_text">
  '.$new_date.'
</td>
</tr>
<tr>
<td class="main_text" colspan="2">
  '.$desc3.'
</td>
</tr>
</table>';
?>

 

Can any one please help.

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/52704-passing-variable-through-iframes/
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.