Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/14168-re-iframe/
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]
Link to comment
https://forums.phpfreaks.com/topic/14168-re-iframe/#findComment-55570
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.