need to convert field names into array for form submission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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']}"> &nbsp;
                    <input  maxlength="6" size="6"
name="phone_exchange" id="phone_exchange"
value="{$_POST['phone_exchange']}"> &nbsp;
                    <input  maxlength="10" size="10"
name="last_4_digits" id="last_4_digits"
value="{$_POST['last_4_digits']}"> &nbsp;

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::

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux