Double up

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 22, 2014   (RSS)

By Toledoh - January 20, 2014

Hi Guys,

Why am I getting a duplicate of the first item I select here? 

http://shalomcollege.com/paf/test.php

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php include ("../_globalViewerCode.php") ?>

<form action="test.php" method="post">
<input type="checkbox" name="check_list[]" value="A">
<input type="checkbox" name="check_list[]" value="B">
<input type="checkbox" name="check_list[]" value="C">
<input type="checkbox" name="check_list[]" value="D">
<input type="checkbox" name="check_list[]" value="E">
<input type="submit" />
</form>
<?php
if(!empty($_REQUEST['check_list'])) {
    $list = "";
    foreach($_REQUEST['check_list'] as $check) {
            $list .= "\t".mysql_escape($check)."\t";
            echo $list; //Should list all values checked...
    }
}

?>

Cheers,

Tim (toledoh.com.au)

By Toledoh - January 22, 2014

Ahhh - that makes perfect sense - thanks!

Cheers,

Tim (toledoh.com.au)