FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Simpler way to validate form fields?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Simpler way to validate form fields? [message #179803 is a reply to message #179802] Thu, 06 December 2012 16:51 Go to previous message
Gilles Ganault is currently offline  Gilles Ganault
Messages: 27
Registered: September 2010
Karma:
Junior Member
On Thu, 06 Dec 2012 17:50:01 +0100, "M. Strobel"
<sorry_no_mail_here(at)nowhere(dot)dee> wrote:
> I don't know offhand what exactly PHP makes of your GET URL, but be aware that the
> forward slash is a path separator.
>
> The regex is okay. Find ways to quickly test code bits, or functions, if possible
> just use the command line. My test (newlines inserted for reading):
>
> php > $d = "01/01/2112";
> php > echo filter_var($d,
> FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^\d{2}\/\d{2}\/\d{4}/ "))),
> PHP_EOL;
>
> 01/01/2112
>
> php > echo urlencode($d), PHP_EOL;
>
> 01%2F01%2F2112
>
> Write regexp here with a different separator, easier to read:
> array("regexp"=>"#^\d{2}/\d{2}/\d{4}#")

Thanks much for the tips.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit
Next Topic: How to Prevent Apache Server From Hanging while running a batch file?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 13:58:04 GMT 2024

Total time taken to generate the page: 0.05012 seconds