I have a page that holds two iFrames. The first iFrame is a form the user has to fill out. The second iFrame prints the results the form gives. When the page is first loaded with the two iFrames, I want the second to hold a default page that says "Please Fill Out The Form". Once they do and hit submit, I want the the second frame to change to the results. My form works, and when you first load the page it seems to work, however, once I hit submit, it sends to a new page that just shows the results. Please advise, thanks.

Recommended Answers

why are you using iframes?

Jump to Post

Ya frames are sloppy, use ajax.

Jump to Post

All 5 Replies

why are you using iframes?

Ya frames are sloppy, use ajax.

The way the link shows is how I thought I was suppose to do it, but it doesn't work. Here are the iFrames......

<td width="580" valign="top" align="center">
									<iframe name="LinkBackForm" width="600" height="400" align="middle" src="linkForm.php" frameborder="0" ></iframe>
							  </td>								
							</tr>
							<tr align="center">
							  <td width="580" valign="middle" align="center">
							  <iframe name="URL" width="500" height="200" align="middle" src="functions/linkBackCode.php" frameborder="1"></iframe>
							  </td>

Here is the first line of the form....

<form action="functions/linkBackCode.php" method="get" target="URL" >

I am not sure what I might be doing wrong with it. The page that houses the iFrames is ...getLinkBack.php. I then have my functions under another folder obviously and I have the form send the info to the linkBackCode.php. In that file, if there is not new URL, it post the phrase "PLEASE FILL OUT FORM". Once someone fills out the form, I want it to refresh that iFrame, not open a new window with the new call. Does that make sense? Thanks for the help.

I ran a test and it works for me, here is my code
file:test.php

<!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>
</head>

<body>
<table>
    <tr>
	<td width="580" valign="top" align="center">
            <iframe name="LinkBackForm" width="600" height="400" align="middle" src="test1.php" frameborder="0" ></iframe>
      </td>								
    </tr>
    <tr align="center">
      <td width="580" valign="middle" align="center">
      <iframe name="URL" width="500" height="200" align="middle" src="test2.php" frameborder="1"></iframe>
      </td>
    </tr>
</table>
</body>
</html>

file:test1.php

<!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>
</head>

<body>
<form target="URL" action="test2.php" method="get">
	<input type="text" name="txtOne" /><br />
    <input type="text" name="txtTwo" /><br />
    <input type="submit" name="btnSubmit" />
</form>
</body>
</html>

file:test2.php

<?
if(count($_POST) > 0)
{
	print_r($_POST);
	echo "<br />";
}
if(count($_GET) > 0)
{
	print_r($_GET);
	echo "<br />";
}
?>

This is frame 2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.