Jump to content

"go" Menu And Iframe Targetting


Recommended Posts

Hi all,

I want a "go menu" (on index) to load "data" (on data) in an "Iframe" (on info) and display selected data by moving to an anchor on the data page.

Page1: Index.php with Form and go menu

Page2: info.php with Iframe Id="InfoIframe" name="InfoIframe" src=data.php

Page3: data.php with various anchors and Data - Currency, Climate, Customs etc

This is my proposed form:
<form name="Form_AB" method="POST">
id="CB_AB" name="CB_AB"
<option value="0" SELECTED>Please Select</option>
<option value="1">Customs</option>
<option value="2">Currency</option>
<option value="3">Culture</option>
<option value="4">History</option>
<input type="submit" name="Button_AB" value="Go" id="Button_AB">


1: Should I use "Submit" and "post" the form?
2: if so what would be the action "action=" ?

3: Should I use "button" and onClick="document.location.href=
4: if so what would be the 'document.location.href='?

Do I need to make other changes to ie: to the iframe src=data.php....etc ?

or Is there a totally better way of achieiving this?

Or can this not be done?

thanks in advance for any constructive input or comments

Kind regards
DD
Link to comment
https://forums.phpfreaks.com/topic/13249-go-menu-and-iframe-targetting/
Share on other sites

Although I would recommend you used "GET" feature and set the information with a few links using the code below:

[code]<?PHP
$menu = $_GET['menu'];
if( !$menu )
{
include("index_page");
exit;

} elseif( $menu == customs ) {

include("customs.html");
exit;

} elseif( $menu == currency) {

include("currency.html");
exit;

} elseif( $menu == culture ) {

include("culture.html");
exit;

} elseif( $menu == history ) {

include("history.html");
exit;

}else{
die("Error: $menu does not exist");
}
?>[/code]

the above code if placed in index.php would be used as:
[a href=\"http://www.domain.com/index.php?menu=\" target=\"_blank\"]http://www.domain.com/index.php?menu=[/a][!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]Menu Name[!--colorc--][/span][!--/colorc--]
the menu name defines which page is included; Each Link will apear as...

index.php?menu=customs
index.php?menu=currency
index.php?menu=culture
index.php?menu=history
[<a href="?menu=[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]Menu Name[!--colorc--][/span][!--/colorc--]">Link</a>]

However. you could also edit the include(); with using echos. such as...

[code]<?PHP
$menu = $_GET['menu'];
if( !$menu )
{
echo 'Index page';
exit;

} elseif( $menu == customs ) {

echo 'customs';
exit;

} elseif( $menu == currency) {

echo 'currency';
exit;

} elseif( $menu == culture ) {

echo 'culture';
exit;

} elseif( $menu == history ) {

echo 'History';
exit;

}else{
die("Error: $menu does not exist");
}
?>[/code]
  • 3 weeks later...
Firstly, XYN :Thank you for your excellent example, unfortunately I believe I may have inadvertantly mislead you when I wrote "go menu".

This Ladies and Gents is what I am trying to achieve: (without javascript if at all possible)

Issue 1:
I have a combo box with options (page titles) and button, I wish the user to select the options from the combo box and use this to load a page into an Iframe on the same page as the combo box.
- similar to a go menu but use an Iframe

Issue 2
As issue 1 but the Iframe is on a differant page.

Issue 3
I have a datapage, with paragraphs defined with anchors.
I want to use the anchor titles as options in a combo box, I wish the user to be able to select an option and then use that selection to load the datapage into an iframe and move to the specified anchor.

Additionally
I know Iframes are frowned upon so any additional advice as to how to do this with Divs would be appreciated...

Not asking much am I !!!!!!...

Cheers
DD

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.