Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

Anyone know how to pass hidden values to an inline frame PHP

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

Anyone know how to pass hidden values to an inline frame PHP

Postby shawbapmp » Mon Sep 06, 2004 6:45 am

Hi Experts,

I want to pass an input value from an index page HTML to another page which has an inline frame. The inline frame is PHP. In other words:

Page1 (HTML) has a text input form which passes the value to Page2.
Page2 (PHP) GETs the Page1 value and passes it to its inline frame Page3.
Page3 (PHP) Gets the Page2 value and displays it in the inline frame.

Trouble is, the Page2 to Page3 part doesn't work. That's where I'm using HTML Form <input type=hidden name="valu" value="<? =$valu ?>">
and I've also tried value="%=request.form("value")%>">

What gives?
shawbapmp
New php-forum User
New php-forum User
 
Posts: 23
Joined: Mon Sep 06, 2004 6:13 am
Location: Toronto

Postby gesf » Mon Sep 06, 2004 6:55 am

You must use a target in your form, which will be you iframe's name!

Example:
Code: Select all
<form
   target="Your_iFrame_Name"
   action="default_iFrame_Src_File">
   ...
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Re: How to pass value to inline frame

Postby shawbapmp » Mon Sep 06, 2004 7:34 am

Hi GESF,

Thanks for the reply. I tried the TARGET thing, but it still doesn't work.

For some reason, the hidden name/value pair are not working. I'm trying to assign a $variable to the value, as in:

name="pass_value" value="<? =$variable ?>"

It never gets in the target PHP with $new_variable=$_GET['pass_value'];

Am I doing something wrong?
shawbapmp
New php-forum User
New php-forum User
 
Posts: 23
Joined: Mon Sep 06, 2004 6:13 am
Location: Toronto

Postby gesf » Mon Sep 06, 2004 7:41 am

Use post method in your form and in your iFrame get the values with $_POST instead of $_GET or $_REQUEST.
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby shawbapmp » Mon Sep 06, 2004 8:48 am

Hi again GESF,

I tried your latest suggestion and still no go. I'm almost ready to give up.

I seem to be having two problems: firstly, I can't put the variable retrived from the first form into the VALUE= of the type=hidden form on the second page, and secondly, I still can't pass any hidden values to the inline frame PHP, even if I hard code a VALUE=.

If you have any further ideas, give me a reply. Otherwise I think I'll have to abondon this effort. Perhaps the browser I'm using (Mozilla) doesn't support inline frames, although they show up with no problem.

Any last recommendations?
shawbapmp
New php-forum User
New php-forum User
 
Posts: 23
Joined: Mon Sep 06, 2004 6:13 am
Location: Toronto

Postby shawbapmp » Mon Sep 06, 2004 10:48 am

To GESF and others,

I think I've isolated my problem with passing values to an inline frame PHP script with INPUT TYPE=Hiddden, and that is there is nothing to automatically submit the hidden value.

When I changed the TYPE to TEXT, I could see that the variable in the NAME/VALUE pair gets passed to the inline frame PHP only after I pressed enter. Then everything worked fine. But with TYPE=Hidden, the value can't be seen and therefore cannot be submitted.

If anyone knows how I can force the hidden form value to submit, I would appreciate it.
shawbapmp
New php-forum User
New php-forum User
 
Posts: 23
Joined: Mon Sep 06, 2004 6:13 am
Location: Toronto

Postby gesf » Mon Sep 06, 2004 6:14 pm

I really don't know what is causing that, but i'm sure a hidden input value is passed the same way as a text, password or other input's value.
Maybe you can show us the form code where the problem resides!?

Cheers
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby shawbapmp » Mon Sep 06, 2004 6:38 pm

Hi GESF,

I found a way to force the submit using some JavaScript code and the submit() function, and I also solved that problem with the PHP $variable not being interpreted in the VALUE declaration by using the syntax VALUE=" .$variable. " instead of VALUE="<?=$variable ?>".

So with the forced submit and the proper variable passing, you'd think my little inline frame PHP thing works fine, right? No such luck. The Page3 PHP, while it works, does not display in the inline frame but on its own separate page. Nuts! But I'm sure I can make it work by playing around with the TARGET attribute or whatever.

Thanks for all your help, GESF.
shawbapmp
New php-forum User
New php-forum User
 
Posts: 23
Joined: Mon Sep 06, 2004 6:13 am
Location: Toronto

Postby gesf » Mon Sep 06, 2004 9:09 pm

So... it's all working !?
shawbapmp wrote:The Page3 PHP, while it works, does not display in the inline frame but on its own separate page. Nuts!
That's it... a target problem !!

Hope you fix it !
Regards
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron