rich menga books gear search about contact
***Secret FSR Fender guitars? Yes, they exist, and they're right here

Amazon links are affiliated. Learn more.

PHP carry values from checkboxes how-to

For the last couple of days I've been working on this monster PHP form for my biz site. It's definitely the biggest form I've ever done and it's taken a lot of programming. So far it's almost 30k just in code alone without any design like GIF's and JPG's and so on.

The form is simple in nature. It's a multi-page thing that carries values from one part to the next all contained within one file.

A big obstacle (for me) was getting all checkbox values there were checked in the PHP form to carry from one part of the form to the next. Absolutely nowhere on the internet were any SIMPLE instructions on how to do it, so I did a lot of reading and found a way to make it simple. The answer was to put the values into an array and then implode it on destination, like this:

<title>the form</title>

$page = ("$PHP_SELF");
if ($step == "") {
<form method="post" action="$page?step=2">
<input type="checkbox" name="choices[]" value="Choice A">
Choice A<br>
<input type="checkbox" name="choices[]" value="Choice B">
Choice B<br>
<input type="checkbox" name="choices[]" value="Choice C">
Choice C<br>
<input type="submit" name="Submit" value="Submit">

} elseif ($step == "2") {

if ($choices == "") {
echo ("You didn't make a choice. Please <a href="javascript:history.go(-1)">go back</a> and make a choice.");

$getchoices = implode(", ", $choices);
$choices = ("$getchoices");

echo ("You chose $choices");

} else {




The [] for the name on input puts the values into an array. Implode takes the values of the array and separates the ones selected by commas and ta-da, you got it.

I'm posting this process here just in case I ever forget how to do it and need a reference. 😉

A classy guitar t-shirt for classy people

Best ZOOM R8 tutorial book
highly rated, get recording quick!


More articles to check out

  1. Where can a middle aged guy get plain sneakers these days?
  2. An HSS guitar I can actually recommend
  3. The 1,000 year disc, M-DISC
  4. The watch you buy when your smartwatch breaks
  5. This is the cheapest way to get guitar picks
  6. This is the Squier I'd buy had I not just bought one
  7. Plywood might be one of the best electric guitar tonewoods
  8. Why isn't The Whoopee Boys a cult classic?
  9. And then there were the right two
  10. Squier Sub-Sonic, the 24 fret baritone guitar from 20 years ago