I have a script that prevents invalid characters from being passed from a html form to a mysql database using php and I am wondering if there is a way to condense it so instead of declaring the ereg_replace for each field in the html form, to simply use one function to remove invalid characters and html markup from all the fields in the form at once... here is my code, any insight would be great. I am not asking you to do it for me, I just want to know how and what the best way to condense it would be. Thanks in advance. Jas
# --------- Error correction for car_type field -------- $car_type = ereg_replace ("\"", "&q&", $car_type); $car_type = ereg_replace ("'", "&a&", $car_type); $car_type = ereg_replace ("%", "&p&", $car_type); $car_type = ereg_replace ("\\\\", "&bs&", $car_type); # --------- Error correction for car_model field -------- $car_model = ereg_replace ("\"", "&q&", $car_model); $car_model = ereg_replace ("'", "&a&", $car_model); $car_model = ereg_replace ("%", "&p&", $car_model); $car_model = ereg_replace ("\\\\", "&bs&", $car_model); # --------- Error correction for car_year field -------- $car_year = ereg_replace ("\"", "&q&", $car_year); $car_year = ereg_replace ("'", "&a&", $car_year); $car_year = ereg_replace ("%", "&p&", $car_year); $car_year = ereg_replace ("\\\\", "&bs&", $car_year); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php