Jump to content


Photo

Re: iframe


  • Please log in to reply
6 replies to this topic

#1 Gummie

Gummie
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 10 July 2006 - 12:48 PM

Hi Everybody,

Here's my situation:

I've connected to a database and populated a select/combo box. No problem.

When the user makes a selection and submits the form, a new page is opened which displays a query according to their selection. Again no problem.

Here is the problem:

On my form page, I have placed an iframe. I'm trying to load the iframe with the new page that displays the query, but I receive errors along the lines that the variables don't exist. So what's happening?!

The reason for the iframe is so that the user can make a selection and update to see the immediate effect of their choice. Otherwise, they have to go back to the form page, which is rather annoying.

If anyone has come across this before, or can offer wise words of wisdom, I would be grateful indeed.

Thanks in advance all,

Gummie

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 10 July 2006 - 12:51 PM

Post the code of the iframe then and related other code cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 10 July 2006 - 12:52 PM

It sounds like you would have to global the variable in the page that you have in the iframe.

#4 Gummie

Gummie
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 10 July 2006 - 02:38 PM

Thanks for the replies.

This is the code of my form page.

<script type="text/javascript">
<!--
	function Loaders() {
		document.all.Loader.src = 'Main_Display.php';
	}
//-->
</script>

<?php
require_once('odbc.php');
$query = odbc_exec($odbc, "SELECT * FROM Verb_Listing ORDER BY Verb_ita") or die (odbc_errormsg());
?>

<table>
<tr>
<td>

<form id="form1" name="form1" method="post" action="javascript:Loaders()">

<label> <input type="checkbox" name="Ind_Pres" value="true" checked="checked" /> Indicative: Present </label>
<br />
<label> <input type="checkbox" name="Ind_Pass_Pros" value="true" /> Indicative: Passato Prossimo </label>
<br />
<label> <input type="checkbox" name="Ind_Pass_Rem" value="true" /> Indicative: Passato Remoto </label>
<br />
<br />
	
	<select name="Verb_ID" size="20" class="st1">
		<?php
		while($row = odbc_fetch_array($query))
		{
			echo "\n";
			$Italian_Verb = strtolower($row['Verb_ita']);
			echo " <option value = \" " . $row['Verb_ID'] . " \"> " . $Italian_Verb . " &emsp; &emsp; &emsp; [ to " . $row['Verb_ing'] . " ]" . " </option> ";
		}
		odbc_close($odbc);
		?>
	</select>

  <p>
    <label>
    <input type="submit" name="btnSelect" value="Select" style="width: 150px" />
    </label>
  </p>
  
</form>

</td><td>

<iframe name="Loader" width="300" marginwidth="1" height="250" marginheight="1" align="top" scrolling="auto" allowtransparency="true"></iframe>

And this is the code of the file being called (Main_Display.php):

<?php

// Show VERB HEADER.
	$verb = $_POST["Verb_ID"];
	$Ind_Pres = $_POST["Ind_Pres"];
	$Ind_Pass_Pros = $_POST["Ind_Pass_Pros"];
	$Ind_Pass_Rem = $_POST["Ind_Pass_Rem"];
	
	require_once('odbc.php');
	$query2 = odbc_exec($odbc, "SELECT Verb_ita FROM Verb_Listing WHERE Verb_ID = $verb") or die (odbc_errormsg());
	$Title = odbc_fetch_array($query2);

	echo "<div align = 'center'>";
	echo "<table width = '125' border = '0' cellpadding = '0' cellspacing= '0' class = 'table_style'>";
	echo "<tr>";
		echo "<td class = 'verb_header'>" . strtoupper($Title['Verb_ita']) . "</td>";
	echo "</tr>";
	echo "</table>";
	echo "</div>";
	
	echo "<br>";

/*
	echo $Ind_Pres;
	echo $Ind_Pass_Pros;
	echo $Ind_Pass_Rem;
*/

// Display PRESENT tense.
	if ($Ind_Pres == true) {
		require_once('Indicativo_Presente.php');
	} else {
		$Ind_Pres = true;
	}

// Display SIMPLE PAST.
	if ($Ind_Pass_Pros != null) {
		require_once('Indicativo_Passato_Prossimo.php');
	}

// Display REMOTE PAST.
	if ($Ind_Pass_Rem != null) {
		require_once('Indicativo_Passato_Remoto.php');
	}


	odbc_close($odbc);
?>


#5 Gummie

Gummie
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 10 July 2006 - 05:59 PM

*bump*

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 10 July 2006 - 06:32 PM

<iframe src="main_display.php?&Verb_ID=$verb name="content" width="100" height="100"></iframe>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 Gummie

Gummie
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 10 July 2006 - 07:08 PM

Thanks for the suggestion redarrow, I'm working on it. I'll let you know how things go.

Thanks again,

Gummie




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users