/    Sign up×
Community /Pin to ProfileBookmark

Help! My ereg isn’t working

Hello
I am using this simple ereg to check a field.
When doing a var_dump($_POST); it shows that the element is
string (4) ‘1111’ . Despite this my ereg routine doesn’t accept that I have a number in the field. What am I doing wrong ?

Thanks for any help! ?

[code=php]
/*
* Check the Price field
*/

if(!ereg(“^[0-9]$”,$N_price[$i]))
{
$mess = “yes”;
$message1 = “All prices must be numbers only.”;
$message2 = ” – or a decimal point. See line no : “.$Di.” Price: “.$N_price[$i];
require_once (“head.inc”);
require_once (“c_sal_ord_bfm.php”);
exit();
} // endif
[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @DaveinLondon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...