The error is because the $_POST['arrayValue']
doesn't exist. That will happen if none of the boxes are checked.
Your form is missing the <form>
tag and does not have a submit button. Without these elements, it won't work.
Also, you're declaring an array $arrayValue = array();
in your code. I don't think that's necessary here. If you're just trying to get the input values and concatenate them together, you don't need that. As I'm unsure what you're planning to do with it, I've ignored that in my answer.
I've included a working demo below, and that'll probably get you started.
Full code:
<?php
if( isset($_POST['submitButton']) ){
$areas = implode("," , $_POST['arrayValue']);
print_r($areas);
}
?>
<form action="" method="post">
<div class='span5' style='margin-left:0px !important;'>
<label>
<input type="checkbox" name="arrayValue[]" id="area[0]" value="Sparks" style='margin-top:-5px !important;'> Sparks
</label>
</div>
<div class='span5' style='margin-left:0px !important;'>
<label>
<input type="checkbox" name="arrayValue[]" id="area[1]" value="Stead" style='margin-top:-5px !important;'> Stead
</label>
</div>
<div class='span5' style='margin-left:0px !important;'>
<label>
<input type="checkbox" name="arrayValue[]" id="area[2]" value="North Reno" style='margin-top:-5px !important;'> North Reno
</label>
</div>
<input type="submit" name="submitButton"/>
</form>
Output:
Sparks,Stead,North Reno
The above code uses an empty action and thus posts to itself. You'll want to change that according to your requirements.
Hope this helps!