Hello,

I'm having a problem with multiple checkboxs with same name. Here are my
code snippets.

--checkbox.html--
<html><head></head><body>
<form action="checkbox.php" method="post">
        <input type="checkbox" name="fruits[]"  value="apple" checked>apple
        <input type="checkbox" name="fruits[]"  value="orange"
checked>orange
        <input type="checkbox" name="fruits[]"  value="grapes">grapes
        <input type="image" name="submit" value="submit">
</form>
</form>
</body></html>

--checkbox.php--
<?php
$fruits=$_POST['fruits'];
echo "count=".count($fruits)." ";
foreach($fruits as $fruit) {
    echo '-'.$fruit.'-';
}
?>

--output--
count=3 -apple--orange--orange-

I'm gettin duplicate entries in the array (two oranges). It may have to do
with "image" type I'm using to submit the form. Can anyone help?

Thanks,
Scott




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

Reply via email to