Page 1 of 1

Frame issue

Posted: Mon Jul 18, 2005 10:47 pm
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?

Posted: Tue Jul 19, 2005 9:45 am
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).

Posted: Thu Jul 21, 2005 1:13 am
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;>

Posted: Thu Jul 21, 2005 3:57 am
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?

Posted: Thu Jul 21, 2005 4:19 am
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;>

Posted: Thu Jul 21, 2005 6:48 am
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?

Posted: Thu Jul 21, 2005 1:07 pm
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

Posted: Thu Jul 21, 2005 2:29 pm
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.