Jump to content

[SOLVED] Combining Checkbox Values Into Single Variable


sh0wtym3

Recommended Posts

I have a small form with checkboxes, however when multiple checkboxes are selected, only the LAST one gets stored into the variable.  :confused:

 

 

Here is the form:

<td>
<input type="checkbox" name="prop[]" value="residential properties, ">
Residential
</td>
<td>
<input type="checkbox" name="prop[]" value="single family homes, ">
Single Family
</td>
<td>
<input type="checkbox" name="prop[]" value="multi-family homes, ">
Multi Family
</td>
<td>
<input type="checkbox" name="prop[]" value="commercial properties, ">
Commercial
</td>

 

 

And here is the php that stores the variable:

$prop = $_POST['prop'];

 

 

My goal is to echo the variable, and have it produce the output:

"residential properties, single family homes, multi-family homes, commercial properties, and more!"

echo "$prop and more!";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.