Jump to content

[SOLVED] preg match error


EchoFool

Recommended Posts

I keep getting a preg match issue where by even a valid number just sets to 0! This is what i have:

 

<?php
$Quantity = strtolower(mysql_real_escape_string(stripslashes($_POST['Move2'])));
If(!(preg_match('~^\d+$~', $Quantity))){
   $Quantity= 0;
   }

Echo $Quantity;
?>

 

I inputted one and it still comes out as 0 every time.. why is this?

Link to comment
https://forums.phpfreaks.com/topic/145591-solved-preg-match-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.