RE: [PHP-DB] Defined Constants

2005-10-13 Thread Matthias Willerich
2 possibilities:
either you put the defined value instead of the definition down in the
option value (but i'm sure you thought of this one)
or you use echo constant($_POST['myType']);. Or GET, depending on how you
send your form.

Hey, this time I learned something, too! I found it in the php helpfile,
making my way from define to a chapter about constants, to this function.
Here, if you're looking for functionality things, I think it's better than
the online documentation:
http://www.php.net/download-docs.php


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
Sent: 13 October 2005 07:13
To: PHP DB List
Subject: [PHP-DB] Defined Constants


Hi all,

just a very simple question. my form has the following define statements and
select box:

define(JOVIAL, likes to joke alot);
define(CHEERFUL, always wears a smile on his face);
define(ADVENTUROUS, likes sports and plays well too);
define(MYSTERIOUS, there's always something to discover everyday);

select name=myType
  option value=JOVIAL?=JOVIAL;?/option
  option value=CHEERFUL?=CHEERFUL;?/option
  option value=ADVENTUROUS?=ADVENTUROUS;?/option
  option value=MYSTERIOUS?=MYSTERIOUS;?/option
/select

after i post my form, the value $myType will be one of my define statements.
For example, user chooses CHEERFUL thus when i echo $myType, I will get
CHEERFUL but actually, what i really want to get is always wears a smile
on his face.

can someone advise me how i can achieve this?? sounds simple but i really
don't know how!! =(

thanks in advance!!
hwee

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



RE: [PHP-DB] Defined Constants

2005-10-13 Thread Arno Kuhl
In your select, you need to remove the quotes around your defines, otherwise
it is interpreted as a quoted string.
So your select statement should look like:

select name=myType
  option value=JOVIAL?=JOVIAL;?/option
  option value=CHEERFUL?=CHEERFUL;?/option
  option value=ADVENTUROUS?=ADVENTUROUS;?/option
  option value=MYSTERIOUS?=MYSTERIOUS;?/option
/select

Arno
 
 DotContent
 Professional Content Management Solutions
 www.dotcontent.net


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
Sent: 13 October 2005 08:13
To: PHP DB List
Subject: [PHP-DB] Defined Constants


Hi all,

just a very simple question. my form has the following define statements and
select box:

define(JOVIAL, likes to joke alot);
define(CHEERFUL, always wears a smile on his face);
define(ADVENTUROUS, likes sports and plays well too);
define(MYSTERIOUS, there's always something to discover everyday);

select name=myType
  option value=JOVIAL?=JOVIAL;?/option
  option value=CHEERFUL?=CHEERFUL;?/option
  option value=ADVENTUROUS?=ADVENTUROUS;?/option
  option value=MYSTERIOUS?=MYSTERIOUS;?/option
/select

after i post my form, the value $myType will be one of my define statements.
For example, user chooses CHEERFUL thus when i echo $myType, I will get
CHEERFUL but actually, what i really want to get is always wears a smile
on his face.

can someone advise me how i can achieve this?? sounds simple but i really
don't know how!! =(

thanks in advance!!
hwee

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



RE: [PHP-DB] Defined Constants

2005-10-13 Thread Arno Kuhl
Oops - sorry, got that one completely wrong! A solution should say:

form code:
define(JOVIAL, likes to joke alot);
define(CHEERFUL, always wears a smile on his face);
define(ADVENTUROUS, likes sports and plays well too);
define(MYSTERIOUS, there's always something to discover everyday);

select name=myType
  option value=JOVIAL?=JOVIAL;?/option
  option value=CHEERFUL?=CHEERFUL;?/option
  option value=ADVENTUROUS?=ADVENTUROUS;?/option
  option value=MYSTERIOUS?=MYSTERIOUS;?/option
/select


form handling code:
$Type = array();
$Type[JOVIAL]=JOVIAL;
$Type[CHEERFUL]=CHEERFUL;
$Type[ADVENTUROUS]=ADVENTUROUS;
$Type[MYSTERIOUS]=MYSTERIOUS;

echo You selected $Type[$myType];


Hope I got it right this time...

Arno
 
 DotContent
 Professional Content Management Solutions

 Tel 27-11-648-1971
 Fax 27-11-487-1199
 Cel 082-334-0710
 [EMAIL PROTECTED]
 www.dotcontent.net


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
Sent: 13 October 2005 08:13
To: PHP DB List
Subject: [PHP-DB] Defined Constants


Hi all,

just a very simple question. my form has the following define statements and
select box:

define(JOVIAL, likes to joke alot);
define(CHEERFUL, always wears a smile on his face);
define(ADVENTUROUS, likes sports and plays well too);
define(MYSTERIOUS, there's always something to discover everyday);

select name=myType
  option value=JOVIAL?=JOVIAL;?/option
  option value=CHEERFUL?=CHEERFUL;?/option
  option value=ADVENTUROUS?=ADVENTUROUS;?/option
  option value=MYSTERIOUS?=MYSTERIOUS;?/option
/select

after i post my form, the value $myType will be one of my define statements.
For example, user chooses CHEERFUL thus when i echo $myType, I will get
CHEERFUL but actually, what i really want to get is always wears a smile
on his face.

can someone advise me how i can achieve this?? sounds simple but i really
don't know how!! =(

thanks in advance!!
hwee

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

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



Re: [PHP-DB] Defined Constants

2005-10-13 Thread Ng Hwee Hwee
this works like a charm!!! thanks alot!!! :o)

- Original Message - 
From: Matthias Willerich [EMAIL PROTECTED]
To: Ng Hwee Hwee [EMAIL PROTECTED]; PHP DB List php-db@lists.php.net
Sent: Thursday, October 13, 2005 2:28 PM
Subject: RE: [PHP-DB] Defined Constants


 2 possibilities:
 either you put the defined value instead of the definition down in the
 option value (but i'm sure you thought of this one)
 or you use echo constant($_POST['myType']);. Or GET, depending on how
you
 send your form.

 Hey, this time I learned something, too! I found it in the php helpfile,
 making my way from define to a chapter about constants, to this function.
 Here, if you're looking for functionality things, I think it's better than
 the online documentation:
 http://www.php.net/download-docs.php


 -Original Message-
 From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
 Sent: 13 October 2005 07:13
 To: PHP DB List
 Subject: [PHP-DB] Defined Constants


 Hi all,

 just a very simple question. my form has the following define statements
and
 select box:

 define(JOVIAL, likes to joke alot);
 define(CHEERFUL, always wears a smile on his face);
 define(ADVENTUROUS, likes sports and plays well too);
 define(MYSTERIOUS, there's always something to discover everyday);

 select name=myType
   option value=JOVIAL?=JOVIAL;?/option
   option value=CHEERFUL?=CHEERFUL;?/option
   option value=ADVENTUROUS?=ADVENTUROUS;?/option
   option value=MYSTERIOUS?=MYSTERIOUS;?/option
 /select

 after i post my form, the value $myType will be one of my define
statements.
 For example, user chooses CHEERFUL thus when i echo $myType, I will get
 CHEERFUL but actually, what i really want to get is always wears a
smile
 on his face.

 can someone advise me how i can achieve this?? sounds simple but i really
 don't know how!! =(

 thanks in advance!!
 hwee

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


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