Forum Moderators: coopster
I have a form on a page....lets call it one.php
This forms target it the same page one.php
I know how to make an iframe appear when the form has been submited with certain characteristics, but how do I get the reults of the form to appear in the iframe.
Im trying to make it simple to highlight the form results and I am aware there is a piece javascript that can highlight iframe content.
Does the iframe contents have to be a seperate page?
Is there a good way to make a second page with the results? Can it just be:
<?php
echo $_POST['formpart'];
?>
ps. this is a new user name for a not-so-new user, I am however always grateful to all who help here.
Is there a reason why the results have to appear in an iframe? Can't you just display the results of the form on the page or in a pop-up?
One way to do this would be to create a temp file and drop the html you want to display in it and point the iFrame to it. Haven't tried it but in theory it should work.
Cool name by the way, "can i get a rewind"
-------------------------------------------
<?php
$page = fopen("results.html", "w");
$page_content = "<html><head><title>Results</title></head><body>";
$page_content .= "<b>Proper Bo I tell thee</b>";//this is where you dump the results
$page_content .= "</body></html>";
fwrite($page, $page_content);
fclose($page);
?>
<html>
<head></head>
<body>
<iframe src="results.html" title="results">
<!-- alternate content for non-supporting browsers -->
</iframe>
</body>
</html>
-------------------------------------------
That basically does what you're after but you'll need a way of making random results filenames and "cleaning up" the results files when they are no longer needed.
So everytime a form is submited a new .html is created with a new name and the content of the form which then appears in the iframe.
I could make the new pages random quite simply by creating a random number and calling it $newpage and then
doing something like this:
-------------------------------------------
randomnumber (not actually creating here) = $newpage
$page = fopen($newpage . ".html", "w");
$page_content = "<html><head><title>Results</title></head><body>";
$page_content .= "<b>Proper Bo I tell thee</b>";//this is where you dump the results
$page_content .= "</body></html>";
fwrite($page, $page_content);
fclose($page);
?>
<html>
<head></head>
<body>
<iframe src="<?php $newpage?>.html" title="results">
<!-- alternate content for non-supporting browsers -->
</iframe>
</body>
</html>
-------------------------------------------
correct?
I could use a folder just for the temps and empty is every now and again, the files will only be small.
Anyone have a better/simpler way of doing this?
The file iframe.php can now print out the parameters it has sent to it.
echo $_GET['val1'];
echo $_GET['val2'];