Page 1 of 1

frameset

Posted: Fri Jun 05, 2009 8:36 am
by yaco_dev
dear all
how can i use the frameset with drop down menu
i have a drop down menu have some elemnets when i choose an element
show it's page without refresh

Re: frameset

Posted: Fri Jun 05, 2009 12:03 pm
by mikemike
This is simple HTML, just set the target of the form to the name of the frame you wish to change.

Code: Select all

<form target="myframe" method="post" action="mypage.php">
<select name="page">
  <option value="1">Page 1</option>
  <option value="2">Page 2</option>
</select>
<input type="submit" name="submit" value="Change page" />
</form>
mypage.php

Code: Select all

<?php
switch($_POST['page']){
  case(1):
    header("Location: page1.php");
    break;
  case(2):
    header("Location: page2.php");
    break;
  default:
    header("Location: default_page.php");
}
exit();
?>

Re: frameset

Posted: Sat Jun 06, 2009 1:39 am
by yaco_dev
thx for help
but wht is wrong
i have page name t1.html

Code: Select all

 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
 
<body>
<form target="myframe" method="post" action="mypage.php">
<select name="page">
  <option value="1">Page 1</option>
  <option value="2">Page 2</option>
</select>
<input type="submit" name="submit" value="Change page" />
</form>
</body>
</html>
 

and page name mypage.php

Code: Select all

 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
<?php
switch($_POST['page']){
 case(1):
   header("Location: page1.php");
   break;
  case(2):
   header("Location: page2.php");
    break;
  default:
   header("Location: default_page.php");
}
exit();
?>
</body>
</html>
 
when i run t1.html
it open the choosing in new window
i want to open in same window without refresh

Re: frameset

Posted: Sat Jun 06, 2009 3:01 am
by yaco_dev
here is what i want
but using combo with frameset not div
http://www.dynamicdrive.com/dynamicinde ... viewer.htm

Re: frameset

Posted: Sat Jun 06, 2009 10:34 am
by mikemike
I did stress you need to sue a frame or iframe. I assumed you'd put that code in yourself as you were asking for the PHP