473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

frames and $_POST. How to

348 100+
Hi all,

I have an interface that will be using 2 horizantal frames. The top frame is the header and uses a select tag with javascript. When the onchange event occurs it uses the form action to post to frame 2.

How can I get the $_POST var into frame 2? Should I be using a session for this?

Thanks,

Frank
Aug 12 '08 #1
5 1950
fjm
348 100+
I have a bit more to report on this. My form tag is inside the header.php and is written as:

Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="../../index.php" target="main">
"Main" is the area that should be populated with the results from the form tag. What is interesting is that if I change my frameset name to "_top" and I do a print_r of the post var, I can see the value echoed there. :) When I change it back to "main" I get nothing.

Should I be using _top instead of the frame name?
Aug 12 '08 #2
r035198x
13,262 8TB
Are you sending the value selected in the top frame as it is or are you calculating something (perhaps using some database vales) to come up with what should be displayed in the bottom frame? Generally this should be possible using Javascript or AJAX(if you need to use database values).
Aug 12 '08 #3
fjm
348 100+
Are you sending the value selected in the top frame as it is or are you calculating something (perhaps using some database vales) to come up with what should be displayed in the bottom frame? Generally this should be possible using Javascript or AJAX(if you need to use database values).
Hi r035198x,

Thanks for the help. The value from the top frame is being dynamically generated from a database and that "value" is what I need to be passed in the lower "main" frameset. I'm not calculating anything per se but only querying for the value to be passed.

I must admit that it has been probably 10 years since I have done anything with frames and I have forgotten most of what I knew. I think it is possible to get the value from frame1 into frame2; I just think part of my problem is my lack of knowledge of frames.

What I have done and it actually seems to be working is that I have changed the name in the form tag from index.php to body.php. Body.php is what will handle most of the db processing and then rendered to the lower frame.

When I made that change, it worked perfect. I can see the post var being echo'd just fine. Is this the way that frames should work?

Another thing that bothers me is since the body.php will be doing the processing, I will need to pass the value of the top frame into it. How am I going to handle that? Should I pass the value into the index.php where the frameset resides or pass it into the body.php file?

BTW: I feel honored that the actual admin of the site (with over 10k posts) answered me. :)

Thanks,

Frank

EDIT:
I had forgotten to add that the "frame src" must be a file.
Expand|Select|Wrap|Line Numbers
  1. <frame src=\"body.php\" name=\"main\">\n";
How would I instantiate an object in place of the file? I would like to use OO methodologies here.
Aug 12 '08 #4
r035198x
13,262 8TB
Hi r035198x,

Thanks for the help. The value from the top frame is being dynamically generated from a database and that "value" is what I need to be passed in the lower "main" frameset. I'm not calculating anything per se but only querying for the value to be passed.

I must admit that it has been probably 10 years since I have done anything with frames and I have forgotten most of what I knew. I think it is possible to get the value from frame1 into frame2; I just think part of my problem is my lack of knowledge of frames.

What I have done and it actually seems to be working is that I have changed the name in the form tag from index.php to body.php. Body.php is what will handle most of the db processing and then rendered to the lower frame.

When I made that change, it worked perfect. I can see the post var being echo'd just fine. Is this the way that frames should work?

Another thing that bothers me is since the body.php will be doing the processing, I will need to pass the value of the top frame into it. How am I going to handle that? Should I pass the value into the index.php where the frameset resides or pass it into the body.php file?
...
I'm not a fan of frames myself. You'll probably need to handle the case when the user's browser is not supporting them.
If the value to be displayed on the second frame is from database look-up then you probably want to use AJAX to refresh that value in the bottom frame. That means the whole page is not submitted. The form submit in that case will call a Javascript function rather than the PHP file. The PHP file will then be called by the AJAX call.



...

BTW: I feel honored that the actual admin of the site (with over 10k posts) answered me. :)

Thanks,

Frank
10k posts can just as well be obtained by posting nonsense so I wouldn't read much into that.
Aug 12 '08 #5
fjm
348 100+
Thanks r035198x. I will look into AJAX for this. Unfortunately, never got into javascript so I have got a bit of studying to do. :)


Thanks,

Frank
Aug 12 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Adrian Parker | last post by:
Is it possible to click on a button, and not have it's value and name stored in _POST? I have this script with a button on it. When you click the button, the page posts to itself. The first...
4
by: Kevin | last post by:
I am having problems in my php code. I am relatively new to php but I know some basics. This is the problem: when i try to echo some information that is typed into form back to the screen i...
6
by: BWGames | last post by:
Hey all, I have a website, which uses frames (I know, I know...). Left frame is a navbar, with the main content in the right frame. I can login using sessions on the right frame, giving...
1
by: Dave Smithz | last post by:
Hi there, I have implemented a login sequence using session variables for a PHP/MySQL DB which I took over development. I read some books and this NG and it seemed straight forward. However the...
3
by: Chris Geerdink | last post by:
i made myself a guestbook. when people want to write in it, a pop-up appears with the form. now this is what i want to happen when they wrote in it: the pop-up has to close itself ( self.close()...
5
by: comp.lang.php | last post by:
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA $_POST if ($_POST && (!is_array($leaseObj->errorArray)...
3
by: scabman | last post by:
Working on upgrading a site and after moving everything onto a test server (localhost) things started to get real buggy. Went through and checked all my links and everything comes up fine, but it...
1
by: Ike | last post by:
I have what is perhaps a stupid problem. I have a form where users enter values (call this page1.php), and these then need to be POSTed to a page (page2.php) (code at bottom of this posting), that...
1
by: R. Vince | last post by:
I have a page, which writes a cookie, creating two frames. I have verified via Fireplug that the cookie is being written. In one of the frames, an attempt then is made to read the cookie. Therein,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.