Dillon, John wrote:

My problem relates to IF statement in the following code.  There are two
checkboxes, named altid$thisid, so for instance they become altid36 and
altid37.  When the form is submitted with both checked, I can read the first
altid36, but the second does not pass the IF test.  Any suggestions re
possible reasons?


$checkedalts = array(); $x=0; $y=1; $array_id = explode(",", $_POST["idlist"]); foreach($array_id as $thisid){ if(${"altid" . $thisid} == 1){ //OR if(ISSET($_POST["${"altid" . $thisid}"])){ $checkedalts[$x] = $thisid; $checkedalts[$y] = ${"altprice" . $thisid}; $x=$x+2; $y=$x+1; } }

The HTML before submission is (without the <!--):

<!--
<tr>
                  <td>Whatever</td>
                  <td><input type="checkbox" name="altid36"  value="1"

</td>

<td class=textset22><input size="10" type=textfield value="" name="altprice36"></td> </tr><tr> <td>Something else</td> <td><input type="checkbox" name="altid37" value="1"

</td>

<td><input size="10" type=textfield value=""
name="altprice37"></td>
</tr><tr> //-->



Not what you're looking for, but... are you sure you're doing this the easiest way?


Try putting your values in an array instead, e.g.

altid[36] and altprice[36]

Then access through:

foreach ($_POST['altid'] as $id => $value)
{
  $price = $_POST['altprice'][$id]
}


Regards,


David

--
David Grant
Web Developer

[EMAIL PROTECTED]
http://www.wiredmedia.co.uk

Tel: 0117 930 4365, Fax: 0870 169 7625

Wired Media Ltd
Registered Office: 43 Royal Park, Bristol, BS8 3AN
Studio: Whittakers House, 32 - 34 Hotwell Road, Bristol, BS8 4UD

Company registration number: 4016744

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to