thank Bastien
I did try that, but the input is going into one column or it is take the last array value and put it each chart in the table.
<input type="checkbox" name="games[]" value="football" />
in that case, these are the value i got in mysql: f, o, o, t
foreach($_POST['games'] AS $game => $value)
$valuecount = count($_POST['games']);
for($i =0; $i < $valuecount; $i++)
$sql = mysql_query("insert into interest values('$value[0]','$value[1]','$value[2]','$value[3]')");
i'm looking forward to hearing from you.
kind regards; m
>From: "Bastien Koert" <bastien_k@xxxxxxxxxxx>
>To: mmoses@xxxxxxxxxxx, php-db@xxxxxxxxxxxxx
>Subject: RE: Re: checkbox into mysql using php <input type="checkbox" name="list
>Date: Wed, 16 Feb 2005 21:38:10 -0500
>
>$value is not an array...wont run
>
>try
>
>$valuecount = count($_POST['games']);
>
>bastien
>
>>From: "moses Woldeselassie" <mmoses@xxxxxxxxxxx>
>>To: php-db@xxxxxxxxxxxxx
>>Subject: RE: Re: checkbox into mysql using php <input
>>type="checkbox" name="list
>>Date: Wed, 16 Feb 2005 22:09:09 +0000
>>
>>Thank you,
>>
>>i don't have any problem using that syntax:
>>if (isset($_POST['submit'])) {
>> echo "You chose the following games:<br />";
>> foreach($_POST['games'] AS $game => $value)
>> $sql = mysql_query("insert into interest(username)
>>values('$value')");
>>
>>but the problem is with the following:
>>
>>
>>$valuecount = count($value)
>>for($i =0; $i < $valuecount; $i++) {
>>$sql = mysql_query("insert into interest values('$value',
>>'$value[$i]')");
>>
>>I don't get any input into mysql.
>>
>>kind regards
>>m
>>
>>
>>&gt;From: pete M &lt;pmorgan@xxxxxxxx&gt;
>>&gt;To: php-db@xxxxxxxxxxxxx
>>&gt;Subject: Re: checkbox into mysql using php &lt;input
>>type=&quot;checkbox&quot;
>>name=&quot;list[]&quot;value=&quot;x&quot;&gt;
>>&gt;Date: Wed, 16 Feb 2005 18:22:14 +0000
>>&gt;
>>&gt;foreach($_POST['name'] as $k =&gt; $v){
>>&gt;
>>&gt;}
>>&gt;
>>&gt;moses Woldeselassie wrote:
>>&gt;&gt;hi all
>>&gt;&gt;
>>&gt;&gt;
>>&gt;&gt;I need a simple php script to use for html
>>&gt;&gt;
>>&gt;&gt;
>>&gt;&gt;
>>&gt;&gt;&lt;form action=&quot;checkbox.php&quot;
>>method=&quot;post&quot;&gt;
>>&gt;&gt; Select from the list &lt;br /&gt; (check all that
>>apply):&lt;br /&gt;
>>&gt;&gt; &lt;input type=&quot;checkbox&quot;
>>name=&quot;list[]&quot; value=&quot;x&quot;&gt;
>>&gt;&gt; &lt;input type=&quot;checkbox&quot;
>>name=&quot;list[]&quot; value=&quot;y&quot;&gt;
>>&gt;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot;
>>value=&quot;Go!&quot; /&gt;
>>&gt;&gt;&lt;/form&gt;
>>&gt;&gt;
>>&gt;&gt;kind regards
>>&gt;&gt;meberat
>>&gt;
>>&gt;--
>>&gt;PHP Database Mailing List (http://www.php.net/)
>>&gt;To unsubscribe, visit: http://www.php.net/unsub.php
>>&gt;
>>
>>--
>>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
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php