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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -