I'm comparing the values of a check box, against another form field, and it sort of works, but I don't understand why (A better solution? is listed below it?

TIA,
David Jackson

---------------------------
And part of the HTML Form:
---------------------------
<td><b>Account Type:</b></td>
<td>Asset</td><td><input type="radio" name="transid" value="1000"></td>
<td>Liability</td><td><input type="radio" name="transid" value="2000"></td>

<input type="text" name="coa_acct" size="5" maxlength="5">

----------------------------------
Here's the one that's puzzling me:
----------------------------------
if ( ereg("^1",$_POST['transid'])== ereg("^1",$_POST['coa_acct'])):
echo $_POST['coa_acct'];
else :
echo "Get off you Asset!";
exit;
endif;

---------------------------------------
The "better" solution using substrings?
---------------------------------------
if ( substr($_POST['transid'],0,1)== substr($_POST['coa_acct'],0,1)):
echo $_POST['coa_acct'];
else :
echo "Get off you Asset!";
exit;
endif;




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

Reply via email to