Reply to Re: multiple selection insert to DB

Your name:

Reply:


Posted by J.O. Aho on 12/29/06 08:03

Ace wrote:
> Dear all
>
> I have use DW making a PHP site and has set a multiple selection
> field..But I don't know how to write the SQL statement to database like
>
> <select name="support[]" size="3" multiple="multiple" id="support">
> <option value="1">Apple</option>
> <option value="2">Orange</option>
> <option value="3">Banana</option>
> <option value="4">Watermelon</option>
> </select>
>
> If I choose 1 & 4, my database table will capture to array..I want the
> DB can be caapture the 1,4, please teach me how to do this.(I know
> array is a vars but i don't know how to write the statement)

Much depends on how you want to store the data

One line, comma between entries:
$theline=implode(',',$_REQUEST['support']);

Do something for each entry:
for($i=0;$i<count($_REQUEST['support']);$i++) {
$currentvalue=$_REQUEST['support'][$i];
/* do what you want with the $currentvalue */
}


> BTW..If I would like recall this field to display. how to do it

The above for loop.

--

//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация