Hi
I try to check the item price that user enter must be in decimal format
I search to internat and find this script
----------------------------------------------------------
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~ s/,//;
-----------------------------------------------------------
but it still don't work perfectly cos if I enter 40.5a it's still accept.
Is the code is right? thanks
I try to check the item price that user enter must be in decimal format
I search to internat and find this script
----------------------------------------------------------
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~ s/,//;
-----------------------------------------------------------
but it still don't work perfectly cos if I enter 40.5a it's still accept.
Is the code is right? thanks