$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
>From: pete M <pmorgan@xxxxxxxx>
>To: php-db@xxxxxxxxxxxxx
>Subject: Re: checkbox into mysql using php <input
type="checkbox" name="list[]"value="x">
>Date: Wed, 16 Feb 2005 18:22:14 +0000
>
>foreach($_POST['name'] as $k => $v){
>
>}
>
>moses Woldeselassie wrote:
>>hi all
>>
>>
>>I need a simple php script to use for html
>>
>>
>>
>><form action="checkbox.php"
method="post">
>> Select from the list <br /> (check all that apply):<br
/>
>> <input type="checkbox" name="list[]"
value="x">
>> <input type="checkbox" name="list[]"
value="y">
>><input type="submit" name="submit"
value="Go!" />
>></form>
>>
>>kind regards
>>meberat
>
>--
>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