Re: [PHP] Var question

2002-10-24 Thread 1LT John W. Holmes
You can just check for 

if(isset($_POST['go']))

You don't really care what the value is since it's just a button.

---John Holmes...

- Original Message - 
From: Clint Tredway [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 24, 2002 9:33 AM
Subject: [PHP] Var question


 I am building a form that posts to itself. 
 
 I have the following to detect the submit button being clicked:
 If($_POST[go] == add link)
 
 I am getting a warning that says 'go' is undefined. How do I define
 this?
 
 Thanks,
 Clint
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Var question

2002-10-24 Thread Maxim Maletsky

is go a variable that is passed via post? I guess yes but you get this
error without submitting yet.

There are three solutions:

1. Change your error reporting level to 55:  error_reporting(55). This
will stop warning your undefined variables.

2. Prefix the variable with an at-mark:  @$_POST['go']. This is a
quickie.

3. Most elegant way: add one more check: if(isset($_POST['go']) and $_POST['go']
== 'add link').


--
Maxim Maletsky
[EMAIL PROTECTED]


www.PHPBeginner.com  // PHP for Beginners
www.maxim.cx // my Home

// my Wish List: ( Get me something! )
http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3



Clint Tredway [EMAIL PROTECTED] wrote... :

 I am building a form that posts to itself. 
 
 I have the following to detect the submit button being clicked:
 If($_POST[go] == add link)
 
 I am getting a warning that says 'go' is undefined. How do I define
 this?
 
 Thanks,
 Clint
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Var question

2002-10-24 Thread Clint Tredway
Thanks guys..

I am moving away from ColdFusion to PHP and so I still forget about the
isset() function.

-Original Message-
From: 1LT John W. Holmes [mailto:holmes072000;charter.net] 
Sent: Thursday, October 24, 2002 8:53 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Var question


You can just check for 

if(isset($_POST['go']))

You don't really care what the value is since it's just a button.

---John Holmes...

- Original Message - 
From: Clint Tredway [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 24, 2002 9:33 AM
Subject: [PHP] Var question


 I am building a form that posts to itself.
 
 I have the following to detect the submit button being clicked: 
 If($_POST[go] == add link)
 
 I am getting a warning that says 'go' is undefined. How do I define 
 this?
 
 Thanks,
 Clint
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] var question

2001-04-16 Thread Plutarck

Add an "=" on the end of your url. Viola.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jeroen Geusebroek"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Guys,

 I have a question about the way PHP handles var/strings.

 Let's say i have this URL: http://foo.bar.com/?login.
 And in my script i have this code:

 if($login) { echo "blab"; } or
 if(isset($login)) { echo "blab"; }

 It always returns FALSE. I think that is because the string
 is empty. Shouldn't PHP, even if a var is empty, put it in
 his var-list?

 Is there another way to do what i want?

 Thanks,

 Jeroen Geusebroek



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] var question

2001-04-16 Thread Aemuli

Actually, I meant the instrument LOL ;)

So as I would pronounce it IRL, "vee-O-luh". I use to spell it wrong, and
was notified of it, but I've decided to just use viola on purpose. I
actually litterally pronounce it "viola".

Some would argue that the majority of people think I just do it to annoy
them. I just like the way "viola" sounds :)

Plutarck
Should be working on something...
...but forgot what it was.


- Original Message -
From: "Brian Clark" [EMAIL PROTECTED]
To: "Plutarck" [EMAIL PROTECTED]
Sent: Monday, 16. April 2001 16:54
Subject: Re: [PHP] var question


 Hi Plutarck,

 @ 5:43:35 PM on 4/16/2001, Plutarck wrote:

  Add an "=" on the end of your url. Viola.

 Heheh, I think you meant Voila which is like "there you are" in
 French?

 Viola is either a) Any of the numerous plants of the genus Viola, or
 b) Slightly larger than a violin, tuned a fifth lower.

 ;-)

 -Brian



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] var question

2001-04-16 Thread Plutarck

Note: Yes, I meant string instrument. Any references to YoYo Ma will be
dealt with swiftly and severly.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Plutarck"" [EMAIL PROTECTED] wrote in message
9bfp5e$169$[EMAIL PROTECTED]">news:9bfp5e$169$[EMAIL PROTECTED]...
 Add an "=" on the end of your url. Viola.


 --
 Plutarck
 Should be working on something...
 ...but forgot what it was.


 ""Jeroen Geusebroek"" [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi Guys,
 
  I have a question about the way PHP handles var/strings.
 
  Let's say i have this URL: http://foo.bar.com/?login.
  And in my script i have this code:
 
  if($login) { echo "blab"; } or
  if(isset($login)) { echo "blab"; }
 
  It always returns FALSE. I think that is because the string
  is empty. Shouldn't PHP, even if a var is empty, put it in
  his var-list?
 
  Is there another way to do what i want?
 
  Thanks,
 
  Jeroen Geusebroek
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] var question

2001-04-16 Thread Steve Edberg

You can also look at environment variable $QUERY_STRING. For example,

 if ($HTTP_SERVER_VARS['QUERY_STRING'] == 'login') {
 ...do log in procedure

If register_globals is on, all you need is

 if ($QUERY_STRING == 'login')

If you might be passing other parameters in the URL, and want to ignore 
case, you could use something like:

 if (eregi('login', $QUERY_STRING)) {

This would match

 www.blah.com?login
 www.blah.com?LogIn
 www.blah.com?loginuser=herman_hollerith

but it would also match

 www.blah.com?sloginthemud
 www.blah.com?login0

So, a little regular expression twiddling might be in order.

For more info, see:

http://www.php.net/manual/en/language.variables.predefined.php
http://www.php.net/manual/en/ref.regex.php
http://www.php.net/manual/en/ref.pcre.php


 -steve



At 02:43 PM 4/16/01 , Plutarck wrote:
Add an "=" on the end of your url. Viola.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jeroen Geusebroek"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi Guys,
 
  I have a question about the way PHP handles var/strings.
 
  Let's say i have this URL: http://foo.bar.com/?login.
  And in my script i have this code:
 
  if($login) { echo "blab"; } or
  if(isset($login)) { echo "blab"; }
 
  It always returns FALSE. I think that is because the string
  is empty. Shouldn't PHP, even if a var is empty, put it in
  his var-list?
 
  Is there another way to do what i want?
 
  Thanks,
 
  Jeroen Geusebroek
 


++
| Steve Edberg   University of California, Davis |
| [EMAIL PROTECTED] (530)754-9127 |
| http://aesric.ucdavis.edu/  http://pgfsun.ucdavis.edu/ |
+-- Gort, Klaatu barada nikto! --+


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]