Jump to content

Recommended Posts

I have a small mail system for my site, however I need to sanatise any use input...

 

I an familiar with:

 

<?php
$output = preg_replace("/[^a-zA-Z0-9s]/", "", $input);
?>

 

to restrict the input to text and numbers only, however, I need to also allow spaces, dots and commers. So could somebody help me add these into this?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/54467-stripping/
Share on other sites

Thats the exact website I got the code above from a few months ago, but it doesnt say anything about keeping spaces, commers, fullstops, and i guess even brackets in the variable. (at least not what I can find)

 

And all the google searches I have come accross always use date examples which also doesnt help :(

Link to comment
https://forums.phpfreaks.com/topic/54467-stripping/#findComment-269419
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.