Maybe a daft question but why would you like to check for a
specific value?
Can you give an example when this is a good thing to do?
You might have two submit buttons, where you want to take a different
action depending upon which one the user clicks.
Chris
=
Chris Shiflett -
Chris Shiflett wrote:
Maybe a daft question but why would you like to check for a
specific value?
Can you give an example when this is a good thing to do?
You might have two submit buttons, where you want to take a different
action depending upon which one the user clicks.
You might
Hello,
What is the difference between these two examples?
Both works fine for me.
1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
in case $_POST['submit'] == 'Yes' only 2nd example works. Right?
-a|fan
Perry Jönsson wrote:
Hello,
What is the difference between these two examples?
Both works fine for me.
1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
--
PHP General
[snip]
What is the difference between these two examples?
Both works fine for me.
1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
[/snip]
One is checking if $_POST contains a specific value, the other just checks to
Dear u r correct,
Both r same...
but in first case ur variable with a constant string value
And in second case u r checking that your variable is set or not
but one limitation with the function is that..
isset() only works with variables as passing anything else will result in a
parse error.
On Mon, 22 Nov 2004 21:38:00 +0100, Perry Jönsson [EMAIL PROTECTED] wrote:
What is the difference between these two examples?
diff 1.txt 2.txt
1c1
1. if ($_POST['submit'] == 'Login') {
---
2. if (isset($_POST['submit']) {
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
On Mon, Nov 22, 2004 at 09:38:00PM +0100, Perry Jönsson wrote:
1. if ($_POST['submit'] == 'Login') { ... }
This one is true if $_POST['submit'] is equal to 'Login'.
2. if (isset($_POST['submit']) { ... }
This one is true if $_POST['submit'] is set, it doesn't matter
which value it has.
/GM
Gerhard Meier wrote:
On Mon, Nov 22, 2004 at 09:38:00PM +0100, Perry Jönsson wrote:
1. if ($_POST['submit'] == 'Login') { ... }
This one is true if $_POST['submit'] is equal to 'Login'.
2. if (isset($_POST['submit']) { ... }
This one is true if $_POST['submit'] is set, it doesn't matter
which
Jay Blanchard wrote:
[snip]
What is the difference between these two examples?
Both works fine for me.
1. if ($_POST['submit'] == 'Login') {
...
...
}
2. if (isset($_POST['submit']) {
...
...
}
[/snip]
One is checking if $_POST contains a specific value, the other
Because you can have more than one submit button per form?
Warren Vail
-Original Message-
From: Perry Jönsson [mailto:[EMAIL PROTECTED]
Sent: Monday, November 22, 2004 12:56 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] $_POST['xxx'] = blabla ?
Gerhard Meier wrote:
On Mon, Nov
[snip]
One is checking if $_POST contains a specific value, the other just checks to
see if it contains a value. If $_POST['submit'] contains 'foo' is ISSET. Make
sense?
Maybe a daft question but why would you like to check for a specific value?
Can you give an example when this is a good
On Mon, 22 Nov 2004 21:57:23 +0100, Perry Jönsson [EMAIL PROTECTED] wrote:
Maybe a daft question but why would you like to check for a specific value?
Can you give an example when this is a good thing to do?
A forum. You have two submit buttons, one labeled 'draft' and one
labeled 'final'.
On Mon, Nov 22, 2004 at 09:55:35PM +0100, Perry Jönsson wrote:
Gerhard Meier wrote:
If you only have one form on a page, why would you like to check the
value/name of the submit button?
Is there a security aspect to this?
That was not your question. You asked what the difference is.
And
I speak under correction but the reason could be that if someone tries to hack
your site, for example I post to your HTML page, you want to check it your
$_POST contains a certain variable (which may be hidden)
Not really sure besides that
Perry Jönsson [EMAIL PROTECTED] 11/22/2004 10:57:23
anything,
could they not be reset easily?
[Original Message]
From: Angelo Zanetti [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Date: 11/23/2004 12:17:37 AM
Subject: Re: [PHP] $_POST['xxx'] = blabla ?
I speak under correction but the reason could be that if someone tries to
hack your
16 matches
Mail list logo