frameset

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yaco_dev
Forum Newbie
Posts: 3
Joined: Fri Jun 05, 2009 8:33 am

frameset

Post 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
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: frameset

Post 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();
?>
yaco_dev
Forum Newbie
Posts: 3
Joined: Fri Jun 05, 2009 8:33 am

Re: frameset

Post 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
Last edited by Benjamin on Sat Jun 06, 2009 1:35 pm, edited 1 time in total.
Reason: Added [code=php] tags.
yaco_dev
Forum Newbie
Posts: 3
Joined: Fri Jun 05, 2009 8:33 am

Re: frameset

Post by yaco_dev »

here is what i want
but using combo with frameset not div
http://www.dynamicdrive.com/dynamicinde ... viewer.htm
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: frameset

Post 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
Post Reply