hello guys,
im having a problem getting the correct result from drop down menu. Working script here
Can you help me, here is the code?
//print.php
$noHole=$_POST['noHole'];
echo "no of hole: $noHole<br/>";
$nBed=2;
for ($cntr=1; $cntr<=$nBed; $cntr++) {
if ($_POST["bedroom" . $cntr]) {
foreach ($_POST["bedroom" . $cntr] as $value) {
$room = "ROOM #" . $cntr;
}
if ($value=="hole_in_wall") {
for ($cntr1=1; $cntr1<=$noHole; $cntr1++) {
if($_POST["holesize" . $cntr1]) {
foreach($_POST["holesize" . $cntr1] as $eli) {
if ($eli=="2") {
echo "$room hole size 2x2<br/> ";
}
if ($eli=="6") {
echo "$room hole size 6x6<br/> ";
}
if ($eli=="12") {
echo "$room hole size 12x12<br/> ";
}
if ($eli=="24") {
echo "$room hole size 24x24<br/> ";
}
if ($eli=="36") {
echo "$room hole size 36x36<br/> ";
}
}}}
}}}
?>
//dropdown.php
<form method="post" action="print.php">
<?
$nBed=2;
for($eli=1; $eli<=$nBed; $eli++) {
?>
<table width="170" border="1">
<tr>
<td width="170" colspan="4"><em><font size="2" face="Arial, Helvetica, sans-serif">ROOM <?= $eli?></font></em></td>
</tr>
<?
$noHole=2;
$cntr=1;
while($cntr <= $noHole){
?>
<tr>
<td width="150"> </td>
<td width="150"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif">Hole #<?= $cntr ?>
</font></div></td>
<td width="150"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif">Size
<select name="holesize<?= $cntr?>[]" id="holesize">
<option value="2" selected>2X2</option>
<option value="6">6X6</option>
<option value="12">12X12</option>
<option value="24">24X24</option>
<option value="36">36X36</option>
</select>
<input type="hidden" name="bedroom<?= $eli?>[]" value="hole_in_wall">
</font></div></td>
<td width="150"><font size="1" face="Arial, Helvetica, sans-serif"> </font></td>
</tr>
<?
$cntr++;
}
?>
</table>
<? } ?>
<input type="hidden" name="noHole" value="<?= $noHole?>">
<input type="submit" name="submit" value="submit">
</form>
Thanks
🙂