I have a loop of processes. And for each process there is checkbox:
</form>
for($y=0;$y<$len;$y++)
{
echo "<div class='proc'> <pre>";
echo "<h6 >Process: ".$proc[$y]." " ;
echo "People required: ".$num[$y].". ";
echo "<input type='hidden' name='link[]' value='0'/><input type='checkbox' name='link[]' value='1'><i title='De-Activate Process' class='fi-link'></i>Connect Process</input></h6></pre>";
}
<input type = "submit" style="margin-left:300px; width:150px;" id="savebutton" name ="submit" class="button" value = "Create Project" onclick="userSubmitted = true;"/>
</form>
After submitting form I got the problem:
$process=$_POST['holdprocess'];
$number=$_POST['holdnumber'];
$link = $_POST["link"];
print_r($link);
foreach( $process as $proc => $eq )
{
if($link[$proc]==1)
echo "process: ".$eq." number: ".$number[$proc]." Process linked: yes<br>";
else
echo "process: ".$eq." number: ".$number[$proc]." Process linked: no<br>";
}
So if all checkboxes are eempty I got this: zero input When i check each checkbox system adds 0 to the array for each process: one input
Why does it happen? Thanks for any help
Aucun commentaire:
Enregistrer un commentaire