multiple choice dropdown box puzzle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think this is a tough one... and way above my head:
PLEASE READ ALL OF THE ABOVE TO UNDERSTAND WHAT I AM TRYING TO DO.
Having a bit of a rough time figuring out how to formulate php-mysql to insert data into fields using a multiple dropdown box in a form.

to post I am using the following:
snip...
$categoriesIN	= $_POST["categoriesIN"];

...snip...

<select name="$categoriesIN[]" multiple="multiple">
	<OPTION>Choose Categories...</option>
		<OPTION VALUE="<? echo $categoriesIN; ?>">1
		<OPTION VALUE="<? echo $categoriesIN; ?>">2
		<OPTION VALUE="<? echo $categoriesIN; ?>">3
		<OPTION VALUE="<? echo $categoriesIN; ?>">4
		<OPTION VALUE="<? echo $categoriesIN; ?>">5
	</SELECT> 

...snip...

$sql4 = "FOR ( $ii = 0 ; $ii < count($categoriesIN) ; $ii++ )
	INSERT INTO temp (example) $categoriesIN[$ii]" ;				
	$result4 = mysql_query($sql4, $db);			
...snip

this does not work! The other posts work like a charm... but this...

I cannot figure out what I should be entering where... I have tried several different configurations, but nothing seems to work...

I found this as a model for entering the selections but can't figure out how to modify it for my needs:

<select name="branch_no[]" multiple="multiple" size="5">
<option > Choose your location(s) </option>
<option value="3100">3100</option>
<option value="3105">3105</option>
<option value="3503"> 3503</option>
<option value="3504"> 3504</option>
</select>

What I would like to do is something like the following:
<select name="$categoriesIN[]" multiple="multiple">
	<OPTION>Choose Categories...</option>
		<OPTION VALUE="1">History
		<OPTION VALUE="2">Temples
		<OPTION VALUE="2">Pharaohs and Queens
		<OPTION VALUE="4">Cleopatra
		<OPTION VALUE="4">Mummies
	</SELECT>
and going further, I would like to be able to use a table that actually holds these values to feed them to the code above. I am sure this is possible but it must take some huge knowledge and experience to do it.

BUT ...
as I look at things, I am wondering if the FOR statement in the above should be used to do several INSERTs, that is, one $sql(number) per selected category... now, would that require many $sqls or many INSERTs within the $sql ?


-- 

Phil Jourdan --- pj@xxxxxxxxxxxxx
   http://www.ptahhotep.com
   http://www.chiccantine.com


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux