|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
The use of IFRAME to show results of php/MySQL
Hi, I have reluctantly taken the decision to use an iFrame as a window in the middle of my page to show the results of my query to the database. I thought this should be simple enough! I cut all the php/MySQL query stuff out of the original page and called it somefile.php (for example), and then replaced this with <iframe src="somefile.php" width="100%" height="100%"></iframe>. The form that posted off the variables for the php/MySQL query is on the same original page, I now changed the action to the somefile.php. So, instead of the whole page disappearing for a few seconds and re-appearing with results, maybe with this new arrangement, only the results in the iFrame will change leaving the rest of the page rock solid. Or not! What now happens now is when the page is called, all the records are displayed without the selection from the form, and worse, when the display is stopped, and a selection is made from the form, just the somefile.php is displayed in the window. I hope that makes sense! I know when it doesn't when MadCowDzz says "I don't get it!"
So basically, to sum it all up, how do I use the IFrame successfully in a page that has the form in the main page. |
|
#2
|
||||
|
||||
|
I don't get it...
![]() I don't know if this is the best suggestion, but using the target attribute on a FORM tag does the trick (sorta) Here's a sloppy example: Code:
<form action="somepage.php" method="get" target="myframe"> <input type="submit"> </form> <iframe name="myframe" src="frame.htm" width="300" height="200"></iframe> I appreciate the explanation with reasoning... Honestly though, is the page refreshing that big of a deal? ![]() This method (including my proposed solution) isn't very accessible to visitors with alternative browsing devices... and personally, I really hate frames.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
|
#3
|
||||
|
||||
|
Sloppy! It's Great! you bet FORM tag does the trick! eh I know I shouldn't be happy- It's the i word that I know you hate. Yes, back in the 80's when I posted my first thread "how do I copy a file in DOS?", you told me about it then. Seriously though, I'll level with you, I have this collapsable menu in the main page (not really just a form), which has a whole bunch of forms which look like text links, I think Mittineague helped me out with a while back (if I was to list all the links down the left of the page it would be too long, so I have to put them in groups and collapse the sub-selections. Well if you open up the menu and select something, when the page re-appears, the menu has collapsed again and users forget what they've just selected.
So, I agree with you, I don't like them, but in this case I have no option, and until I get the code that makes the menu remember where it was opened working, this is a good cop out! Oh, by the way it works thanks, however, what do you mean,"isn't very accessible to visitors with alternative browsing devices..." what do people use other than browsers, or do you mean...your having a pop at MAC users with IE ver 5.2! (quits before you get ahead!) PS reminder - 1 submit 2 actions! |
|
#4
|
||||
|
||||
|
Alternative web browsing devices include anything from a cellphone/pda to a screen reader or voice browser (for users who have difficulty seeing or other disabilities)... web accessibility is a big issue nowadays on the internet, so I try and introduce developers to it all the time
![]() |
|
#5
|
||||
|
||||
|
Quote:
OK I know that iFrames aren't recommended ,but it gets me a nice display of results without the form reseting each time the page is formed. This method is great for when the form menu is in the same page which has the iFrame. I have now come across another problem. I want a drop-down menu from my homepage to send 'get' variables to the iFrame page and to show results to start the ball rolling, Then, there is another drop-down menu on that iFrame page which can be used to get further results. The trouble is those 'get' variables do not reach the 'somepage.php' , only the iFrame page, and so does not show any results. The next problem encountered, is when a new selection is subsequently made it just shows the somepage.php not the whole thing with the iFrame. It is so frustrating, because I am nearly there. So to sum up:- what do I put in the form tag on the homepage for: action and target , so it brings up results in an iFrame page and sends info to the somepage.php? |
|
#6
|
||||
|
||||
|
I'm kind of worried what the resulting page will look like...
drop downs, iframes, drop-downs-within-iframes... ![]() Nonetheless, an exciting web-standard way to do dropdowns could be the Suckerfish Dropdowns or some modified versions. The benefit of these methods is that the drop down list items are simply links... since anchor links issue GET requests, make sure the target is your iframe (similar to the form code above). If i'm off the ball, can you post an HTML example of what you have so far? |
|
#7
|
||||
|
||||
|
Oh! I didn't think we would hear from you as you might be busy installing OS 10.4 on.....something or other. Anyway, while you're here, the page with the iFrame in it has a menu which has method = get, action= somepage.php (which grabs results and displays them), target= results (the name of the iFrame) Once operating from this page, it works great. However, what if I want a similar menu on another page, maybe the index, what action and target do I use for this menu to issue get requests to the iFrame page (as above) and show results? So a user could carry on operating from the iFrame page like I talking about above.
I don't think I need any javescript type suckerfish or milonic menus which use links for their selection. I am thinking very carefully about what you said about drop-down within iFrames just in case I've missed anything. But at the moment I don't think I have. |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Development > The use of IFRAME to show results of php/MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|