I have a problem where I need to pass two variables using GET from a form I
have, to solve a page selection problem I have.
The code is written that if a new visitor arrives at the front page of the
site, because the page id is null, PHP loads the default design. But when
I execute one of my other pages which has a form on it, because I cannot
pass back the id of the page that the form is on (the "submit" GET's the
desired page id only), instead of calling the new page, it executes the
"null" part of the script again. Despite the GET having a different id
(track), it refuses to execute because the page == null code.
The variable of the page needed to be displayed is GET'ed (it's in the
browser URL, and an echo statement in the PHP confirms the value GET'ed,
and lack of the original page id.
How can I get the code to pass both the page id and the data of the
selected form item at the same time?
Dariusz
The PHP
<?
if ($_GET['page'] == NULL)
{
echo $_GET['track']; //value passed from the HTML form
echo $_GET['page']; //value of the page id
include ("index2.php");
}
elseif ($_GET['page'] == index)
{
header ("Location: /index.php");
}
elseif ($_GET['page'] != index)
{
include ("html/".$_GET['page'].".shtml");
}
elseif ($_GET['track'] == a01-t01)
{
include ("html/lyrics/".$_GET['track'].".htm");
}
?>
The form HTML
<FORM method="GET" action="../../index.php" name="myform01">
<select name="track">
<option value="a01-t01" SELECTED>Track 01</option>
<option value="a01-t02">Track 02</option>
<option value="a01-t03">Track 03</option>
<option value="a01-t04">Track 04</option>
</select>
<BR><BR>
<input type="submit" value="Go get the lyrics">
</FORM> 3 19864
Put the page id in a hidden field in the form, then it will be
sendt together with the rest of the forms fields.
--
Dag.
"Dariusz" <ng@lycaus.plusYOURSHIT.com> wrote in message
news:MO******************@wards.force9.net... I have a problem where I need to pass two variables using GET from a form
I have, to solve a page selection problem I have.
The code is written that if a new visitor arrives at the front page of the site, because the page id is null, PHP loads the default design. But when I execute one of my other pages which has a form on it, because I cannot pass back the id of the page that the form is on (the "submit" GET's the desired page id only), instead of calling the new page, it executes the "null" part of the script again. Despite the GET having a different id (track), it refuses to execute because the page == null code.
The variable of the page needed to be displayed is GET'ed (it's in the browser URL, and an echo statement in the PHP confirms the value GET'ed, and lack of the original page id.
How can I get the code to pass both the page id and the data of the selected form item at the same time?
Dariusz
The PHP
<? if ($_GET['page'] == NULL) { echo $_GET['track']; //value passed from the HTML form echo $_GET['page']; //value of the page id include ("index2.php"); } elseif ($_GET['page'] == index) { header ("Location: /index.php"); } elseif ($_GET['page'] != index) { include ("html/".$_GET['page'].".shtml"); } elseif ($_GET['track'] == a01-t01) { include ("html/lyrics/".$_GET['track'].".htm"); }
?>
The form HTML
<FORM method="GET" action="../../index.php" name="myform01"> <select name="track"> <option value="a01-t01" SELECTED>Track 01</option> <option value="a01-t02">Track 02</option> <option value="a01-t03">Track 03</option> <option value="a01-t04">Track 04</option> </select> <BR><BR> <input type="submit" value="Go get the lyrics"> </FORM>
In article <bR*********************@juliett.dax.net>, "Dag Sunde" <da******@orion.no.way> wrote: Put the page id in a hidden field in the form, then it will be sendt together with the rest of the forms fields.
Oh thanks - works great :-)
Dariusz
"Dag Sunde" <da******@orion.no.way> wrote in message news:<bR*********************@juliett.dax.net>... Put the page id in a hidden field in the form, then it will be sendt together with the rest of the forms fields.
-- Dag.
"Dariusz" <ng@lycaus.plusYOURSHIT.com> wrote in message news:MO******************@wards.force9.net... I have a problem where I need to pass two variables using GET from a form I have, to solve a page selection problem I have.
The code is written that if a new visitor arrives at the front page of the site, because the page id is null, PHP loads the default design. But when I execute one of my other pages which has a form on it, because I cannot pass back the id of the page that the form is on (the "submit" GET's the desired page id only), instead of calling the new page, it executes the "null" part of the script again. Despite the GET having a different id (track), it refuses to execute because the page == null code.
The variable of the page needed to be displayed is GET'ed (it's in the browser URL, and an echo statement in the PHP confirms the value GET'ed, and lack of the original page id.
How can I get the code to pass both the page id and the data of the selected form item at the same time?
Dariusz
The PHP
<? if ($_GET['page'] == NULL) { echo $_GET['track']; //value passed from the HTML form echo $_GET['page']; //value of the page id include ("index2.php"); } elseif ($_GET['page'] == index) { header ("Location: /index.php"); } elseif ($_GET['page'] != index) { include ("html/".$_GET['page'].".shtml"); } elseif ($_GET['track'] == a01-t01) { include ("html/lyrics/".$_GET['track'].".htm"); }
?>
The form HTML
<FORM method="GET" action="../../index.php" name="myform01">
<select name="track">
<option value="a01-t01" SELECTED>Track 01</option>
<option value="a01-t02">Track 02</option>
<option value="a01-t03">Track 03</option>
<option value="a01-t04">Track 04</option>
</select>
<BR><BR>
<input type="submit" value="Go get the lyrics">
<input type="hidden" value="<?php print $_GET['page']; ?>" name="page">
</FORM>
Mike Bradley http://gzen.myhq.info -- free online php tools This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Amr Mostafa |
last post by:
Hello :)
I'm trying to write a script that deals with a web service.
I'm using NuSoap class.
my question is : Can I pass some variables By Reference to the web
service and get the result back...
|
by: Richard |
last post by:
**** Post for FREE via your newsreader at post.usenet.com ****
HI,
I am working on a project where I need to input data to a (local) HTML page
using multiple form elements, such as text,...
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: Jack |
last post by:
Hi,
I need to pass multple variables in a link in order to go to a asp page with
the
two varables.
The following are the values of the variables using response.write:
<%'Response.Write Mypage...
|
by: ben |
last post by:
Hi guyz,
I am developing a website using php.This website involves
dealing with forms which span over multiple pages.
I want data obtained from 1 form to be available after 3-4 pages.
This...
|
by: Mike MacSween |
last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime
ago.
Then remembered that arguments are passed by reference, by default.
Does the fact that this slowed me down...
|
by: Anne |
last post by:
hie there, i want to be able to pass multiple parameters
to another page. currently, i am able to do so, but
somehow i feel it is not the correct way to do it. below
is part of what i have so far....
|
by: Scott Zabolotzky |
last post by:
I'm trying to pass a custom object back and forth between forms.
This custom object is pulled into the app using an external reference
to an assembly DLL that was given to me by a co-worker. A...
|
by: Roy |
last post by:
I'm assuming this is amazingly simple and I'm just missing the boat.
On the html side of an asp.net page I have a datagrid, a "search"
button, and 8 text boxes for search criteria. A user enters...
|
by: Dennis D. |
last post by:
Hello:
I want a function to return three variables to the calling procedure:
Private Function CalcTimes(ByVal iAddDays as Integer, ByVal iAddHours as
Integer, ByVal iAddMins as Integer) As...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |