RE: [PHP] using html select as array

2002-04-25 Thread Maxim Maletsky \(PHPBeginner.com\)

Dame thing, no?

Your SELECT name=language[]. You can see all those selected as an
array.
Now, add the text type and call it something different (ie;
custom_lang).

In the page, 

?

If(strlen($_GET['custom_lang'])) {
// do insert of this 
}
else {
// loop the $_GET['Language'] and create your select.
}

Alternatively, you can ALWYS do this second condition, just override
about the language[] if custom_lang is set.


If(strlen($_GET['custom_lang'])) {
($_GET['Language'] =  Array($_GET['custom_lang']);
}

// loop the language[] and create your select.


?


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



 -Original Message-
 From: Rodrigo Peres [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 25, 2002 8:22 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] using html select as array
 
 Hi list,
 
 In my system I have multiples choices of language that user selects
 using drop down menus. So I've named this dropdows language[] and grab
 it as php array, and with looo i insert it into mysql as registers.
But
 now i need to put a text field that the user can type any language
that
 is not in the dropdown. my question is how can i know when this was
 typed when i do the select to update the user itens. I mean, when i
 select and populate your preferences to update, how can i know that
this
 info is from the input text???
 
 
 Thank's
 
 Rodrigo
 
 
 --
 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] using html select as array

2002-04-25 Thread Kevin Stone

You can't know the input type through PHP.  You could use Javascript to
determine the input type and pass that along with the array.  However it may
be easier just to store the text field as a separate variable, and knowing
this, parse it into your languages array after both inputs have been passed
to the server.  You could store languages as a multi-dimensional associative
array.. something like...

$languages = array (
select_field = array('english', 'spanish', 'ect..'),
text_field = swahili;  // or whatever :)
);

So in this way it's a little bit more involved to keep track of everything..
but at least you know that swahili belongs to the text field and the others
belong to the select field.
-Kevin

- Original Message -
From: Rodrigo Peres [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 25, 2002 12:22 PM
Subject: [PHP] using html select as array


 Hi list,

 In my system I have multiples choices of language that user selects
 using drop down menus. So I've named this dropdows language[] and grab
 it as php array, and with looo i insert it into mysql as registers. But
 now i need to put a text field that the user can type any language that
 is not in the dropdown. my question is how can i know when this was
 typed when i do the select to update the user itens. I mean, when i
 select and populate your preferences to update, how can i know that this
 info is from the input text???


 Thank's

 Rodrigo


 --
 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