Frame issue

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Frame issue

Post by S_henry »

In my system, i wanna use 3 frames - top, left, and right. In top frame, i wanna put search function (textbox and button). So for example, if i wanna search student named John, i just have to type 'John' in the top frame and the result will be displayed in the right frame. The problem now, what i can do is very limited. When i click search, i just can view the result also in the same top frame. Anybody got any idea about the solution pls?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

If you set a name for your right frame (In the top level framing page), you can then refer to that name in the target attribute of a form (like the search form).
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Post by S_henry »

Actually i'm still not understand about how to do it. until now it still can't work. Can u explain a bit more detail on that? For example, what should i put at "onClick" event for the search button:

Code: Select all

<input type=&quote;button&quote; name=&quote;btnSearch&quote; value=&quote;Search&quote; onClick=&quote;&quote;>
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Post by S_henry »

Additional info: In the simple word, when i click Search button in the top frame page, then 'Search' page will be displayed/viewed in the right frame. Any idea pls?
nyy2000
Forum Newbie
Posts: 15
Joined: Tue Jul 12, 2005 12:40 am

Post by nyy2000 »

How about adding target in form tag?

Code: Select all

<form name=&quote;fname&quote; method=&quote;POST&quote; target=&quote;name&quote;>
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Post by S_henry »

I've tried to do as u said. Put file name (eg. viewsrch.php) at the form target and then submit the form when button clicked. It still can't. When i click that button, it just popup the top frame's page. None other than that. Or maybe i made a mistake? So any idea pls?
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Maybe I'm too much of a novice, but why not just completely drop the ugly frames and do something else? I know you can use conditionals with isset($variable) to detect when $variable is set to something, and you can place those conditionals anywhere you want. The only thing is that it's not really SECURE =D
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

theda wrote:The only thing is that it's not really SECURE =D
If done properly, it is. :x

For example, on your index.php

Code: Select all

$pages = array(  'page1',
                 'page2',  );


$page = (!empty($_GET&#1111;'page']) ? $_GET&#1111;'page'] : 'page1');

if (in_array($page,$pages) &amp;&amp; file_exists($page.'.php')) {
    include($page.'.php');
}
This is a quick example on some measures you can take.
Post Reply