Hello,
I wrote this trim function which loops through required field array and if the fields are not empty, it trims all of the required fields, I would appreciate any feedback.
Thanks.PHP Code:
$req_fields = array(
$firstname,
$lastname,
$email,
$phone,
$college,
$campus,
$depatment,
$date_needed
);
// TRIM FUNCTION
function trim_fields($val)
{
if(!empty($val))
{
foreach($val as $keys)
{
trim($keys)
}
}
}
if (isset($_POST))
{
trim_fields($_POST);
}





Bookmarks