Thursday, 5 September 2013

Custom Selectable Checkboxes To Display Results In Text Box

Custom Selectable Checkboxes To Display Results In Text Box

I am trying to create a simple Checkbox menu, that will display all
selected values when displayed.
test1.php
<form action="test2.php" method="POST">
<input type="checkbox" name="#Example1," />1<br>
<input type="checkbox" name="#Example2," />2<br>
<input type="checkbox" name="#Example3," />3<br>
<input type="checkbox" name="#Example4," />4<br>
<input type="checkbox" name="#Example5," />5<br>
<input type="submit" name="formSubmit" value="Submit" />
</form>
test2.php
<?php
print_r($_POST)
?>
After submitting it is received as...
Array ( [#Example1,] => on [#Example2,] => on [formSubmit] => Submit )
I would want it to be displayed as...
#Example1, #Example2,
There needs to be a comma between each result, which is why they all have
a comma at the end.

No comments:

Post a Comment