Posted by Bruce Gilbert on 08/12/05 22:39
How would I organize this block in order to convert it into an array
for my form field names.
For instance if my field has:
<p>Home Phone Number:</p> <input maxlength="6" size="6"
name="area_code" id="area_code" value="{$_POST['area_code']}">
<input maxlength="6" size="6"
name="phone_exchange" id="phone_exchange"
value="{$_POST['phone_exchange']}">
<input maxlength="10" size="10"
name="last_4_digits" id="last_4_digits"
value="{$_POST['last_4_digits']}">
I would want something to return an error stating that the phone
number was not completed and not that the field last_4_digits was not
entered.
I believe this can be done with an array.
my error block code is:
function check($fieldname)
{
global $err_msg;
if($_POST[$fieldname] == "") {
if ( !isset($err_msg)) {
$err_msg = "<div class='red'>You haven't entered
your " . str_replace("_", " ", $fieldname) . "!</div><br />";
} elseif ( isset($err_msg)) {
$err_msg .="<div class='red'>You haven't entered
your " . str_replace("_", " ", $fieldname) . "!</div><br />";
}
}
return $err_msg;
}
any assistance is greatly appreciated!
--
::Bruce::
[Back to original message]
|