468,247 Members | 1,317 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

Why ???

For passing values trough successives pages, I use $_SESSION variable.

Here is a simple function I've created:
function getvalue($fieldname){
if (isset($_GET[$fieldname]))
return $_GET[$fieldname];
elseif (isset($_SESSION[$fieldname]))
return $_SESSION[$fieldname];
elseif (isset($_POST[$fieldname]))
return $_POST[$fieldname];
else
return "";
}

I've this form:
<form name="ReturnBack" method="GET" action="/index.php?">
<center><input type="Submit" name="SubmitButton"
value="Retour"></center></form>

in the index.php page, when I show the SubmitButton value, I get "Search",
the one set in the $_SESSION["SubmitButton"]
Why the $_GET["SubmitButton"] value is empty ?? The Submit type doesn't set
the value ????
Jul 17 '05 #1
5 1497
> I've this form:
<form name="ReturnBack" method="GET" action="/index.php?">
<center><input type="Submit" name="SubmitButton"
value="Retour"></center></form>

in the index.php page, when I show the SubmitButton value, I get
"Search", the one set in the $_SESSION["SubmitButton"]
Why the $_GET["SubmitButton"] value is empty ?? The Submit type doesn't
set the value ????


I'm not sure what you mean here, but from your story I gather that you
also have a $_SESSION variable called SubmitButton?

If this is the case then your function will never reach the $_POST
variables because isset($_SESSION['SubmitButton']) will evaluate to true.
Jul 17 '05 #2
It's the $_GET['SubmitButton'] that isnt' called, not the POST. And since my
form is in GET method, it should be called ???

Cheers

"Brommer" <br*****@gmail.com> a écrit dans le message de news:
41***********************@news.xs4all.nl...
I've this form:
<form name="ReturnBack" method="GET" action="/index.php?">
<center><input type="Submit" name="SubmitButton"
value="Retour"></center></form>

in the index.php page, when I show the SubmitButton value, I get
"Search", the one set in the $_SESSION["SubmitButton"]
Why the $_GET["SubmitButton"] value is empty ?? The Submit type doesn't
set the value ????


I'm not sure what you mean here, but from your story I gather that you
also have a $_SESSION variable called SubmitButton?

If this is the case then your function will never reach the $_POST
variables because isset($_SESSION['SubmitButton']) will evaluate to true.

Jul 17 '05 #3
Bob Bedford wrote:
Why the $_GET["SubmitButton"] value is empty ?? The Submit type doesn't set
the value ????


Apparently (I didn't test it) it should work.
Do you have error_reporting set to E_ALL?

.... maybe that will report some misnamed index

--
USENET would be a better place if everybody read: | to mail me: simply |
http://www.catb.org/~esr/faqs/smart-questions.html | "reply" to this post, |
http://www.netmeister.org/news/learn2quote2.html | *NO* MIME, plain text |
http://www.expita.com/nomime.html | and *NO* attachments. |
Jul 17 '05 #4
On Thu, 11 Nov 2004 16:15:25 +0100, "Bob Bedford"
<be******@YouKnowWhatToDoHerehotmail.com> wrote:
"Brommer" <br*****@gmail.com> a écrit dans le message de news:
41***********************@news.xs4all.nl...
I've this form:
<form name="ReturnBack" method="GET" action="/index.php?">
<center><input type="Submit" name="SubmitButton"
value="Retour"></center></form>

in the index.php page, when I show the SubmitButton value, I get
"Search", the one set in the $_SESSION["SubmitButton"]
Why the $_GET["SubmitButton"] value is empty ?? The Submit type doesn't
set the value ????

I'm not sure what you mean here, but from your story I gather that you
also have a $_SESSION variable called SubmitButton?

If this is the case then your function will never reach the $_POST
variables because isset($_SESSION['SubmitButton']) will evaluate to true.

It's the $_GET['SubmitButton'] that isnt' called, not the POST. And since my
form is in GET method, it should be called ???


Do you see " SubmitButton=Retour " in the url after submitting the
form? That will confirm/deny the value is actually being transmitted.

Alternatively, change the form's action to a phpinfo page to confirm
exactly what's where.

--
David ( @priz.co.uk )
Jul 17 '05 #5
Found !!!

I had a redirect (header) that was called that didn't let me see the
javascript alert box !!!! sorry !!!!

"David Mackenzie" <me@privacy.net> a écrit dans le message de news:
7e********************************@4ax.com...
On Thu, 11 Nov 2004 16:15:25 +0100, "Bob Bedford"
<be******@YouKnowWhatToDoHerehotmail.com> wrote:
"Brommer" <br*****@gmail.com> a écrit dans le message de news:
41***********************@news.xs4all.nl...
I've this form:
<form name="ReturnBack" method="GET" action="/index.php?">
<center><input type="Submit" name="SubmitButton"
value="Retour"></center></form>

in the index.php page, when I show the SubmitButton value, I get
"Search", the one set in the $_SESSION["SubmitButton"]
Why the $_GET["SubmitButton"] value is empty ?? The Submit type doesn't
set the value ????
I'm not sure what you mean here, but from your story I gather that you
also have a $_SESSION variable called SubmitButton?

If this is the case then your function will never reach the $_POST
variables because isset($_SESSION['SubmitButton']) will evaluate to
true.

It's the $_GET['SubmitButton'] that isnt' called, not the POST. And since
my
form is in GET method, it should be called ???


Do you see " SubmitButton=Retour " in the url after submitting the
form? That will confirm/deny the value is actually being transmitted.

Alternatively, change the form's action to a phpinfo page to confirm
exactly what's where.

--
David ( @priz.co.uk )

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.