php - Sanitize all except number, forward slash and $? -
i have entry form 'price', , want like:
$250 full price /$230 booking
to sanitized within database to:
250/230
or
$250/$230
is possible either in php?
i've tried:
$formdata = ( isset( $_post['price-entry'] ) ? sanitize_html_class( $_post['price-entry'] ) : '' );
but strips except letters , digits.
try
$price = '$250 full price /$230 booking'; echo get_clean_price($price); function get_clean_price($price) { return preg_replace("/[^\d\/]+/", "", $price); }
Comments
Post a Comment