Hey all,
I'm fairly new to PHP and could use some help. If you look at the code, theoretically if you check the three checkboxes and then submit it should echo "a,b,c" but it doesn't echo anything. If you uncomment the commented code, though, that code works just fine. Why is this?
<html>
<body>
<form name="test" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="checkbox" value="a" name="test[]">
<input type="checkbox" value="b" name="test[]">
<input type="checkbox" value="c" name="test[]">
<input type="submit">
</form>
<?php
$imploded = implode(",", (array)$_POST['$test']);
echo $imploded;//value,value,value if all are checked
/*
$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);
echo $comma_separated; // lastname,email,phone
*/
?>
</body>
</html>