Jump to content

Archived

This topic is now archived and is closed to further replies.

Gummie

Re: iframe

Recommended Posts

Hi Everybody,

[color=blue]Here's my situation:[/color]

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.

[color=blue]Here is the problem:[/color]

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

Share this post


Link to post
Share on other sites
Post the code of the iframe then and related other code cheers.

Share this post


Link to post
Share on other sites
It sounds like you would have to global the variable in the page that you have in the iframe.

Share this post


Link to post
Share on other sites
Thanks for the replies.

This is the code of my form page.

[code]
<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>
[/code]

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

[code]
<?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);
?>
[/code]

Share this post


Link to post
Share on other sites
<iframe src="main_display.php?&Verb_ID=$verb name="content" width="100" height="100"></iframe>

Share this post


Link to post
Share on other sites
Thanks for the suggestion redarrow, I'm working on it. I'll let you know how things go.

Thanks again,

Gummie

Share this post


Link to post
Share on other sites

×

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.