PDA

View Full Version : On submit- open in I-Frame



Andy128
05-08-2007, 11:48 PM
I have a form which has but a single field. That field will be filed in with a UID (unique identification number) and upon submit- I have written a php code that will retrieve that file, open it and present the data in a table.

Question- how do I get it to display in the I-Frame? Since the form submit is actually going to the php page- how do I set the target to the specified I-Frame?

Is there a an html code to place in the begining of the page to make it open in the specified I-Frame?

Andy

navaldesign
05-09-2007, 03:38 PM
Andy, you need total 3 pages to do this.
1. the form page
2. Then, i suppose that you have a page, with the script that retreives the UID and then retreives the file and displayes the data in the table. Let's call it "script.php". In the very start of your php code, add this php line:

<?
$UID = $_GET[UID];
... rest of your script..
..............................
?>

At this point the script has received the UID, no need to receive it through the form.


Normally, with the latest versions of php, $UID is already defined and available, but just to make sure, add this line.

3. The page with the inline frame, which must also be published as php:

Ok, in the 3rd page, in Start of Page, place the php code that receives the POST variables:

<?
$UID = $_POST[UID];
?>
Then, in 3rd page, in the iframe properties, provide as Initial URL, to open in the iframe
" script.php?UID=<? echo $UID ; ?>"

the script page will open in the iframe of the third page, with the data of the specific file, related to the UID that has been posted from the first page.

Please note that the first page can be combined with the 3rd one if you have the appropriate "flags" that will control the flow of the code and the display of the inline frame in the page (a simple if... else.. structure). In that case the form page will submit to itself, otherwise it must have as action the 3rd page

Andy128
05-09-2007, 06:37 PM
Cool! Thanks Naval- I will giver her a go...............

Andy