in reply to Re: Unable to pass 0 number through form with CGI DBI backend
in thread Unable to pass 0 number through form with CGI DBI backend

thats okay but in future if we may need contact info from db we r not gonna get the right number
  • Comment on Re^2: Unable to pass 0 number through form with CGI DBI backend

Replies are listed 'Best First'.
Re^3: Unable to pass 0 number through form with CGI DBI backend
by poj (Abbot) on Sep 12, 2015 at 10:57 UTC

    Consider using a list of allowed characters with negation.

    $mob =~ s/[^0-9-]//gi;
    poj
      that actually worked what do you think was the problem behind it i was just trying to block symbols not numbers using replacement.then why did that happen
        try print "[:;$%&@<>?]";
      thanks man goodbye cya soon
Re^3: Unable to pass 0 number through form with CGI DBI backend
by marto (Cardinal) on Sep 12, 2015 at 10:56 UTC

    Sure, if you throw away data before inserting it into your database, when you query the database in future the data in quesiton won't be there. I'm not sure what you expect. Likely your post does not properly describe your problem.

      i want to keep the zeros in the field as zeros ,i dont wanna loose them suppose some one enters 7890123456 ,in db also it should be 7890123456 (!)not 789123456 . Now how can i not lose those zeros when passing from a cgi script 7890123456 ->turns into->789123456.Thats not what i want i want perfectly intact data

        If you read my first reply you'd see this has nothing to do with passing data from CGI, or DBI. I demonstrate that you're stripping the zeros ($mob =~ s/[:;$%&@<>?]//gi;). My example shows that basic debugging will show you that your code isn't doing what you think it is. If you're going live with some critical service tomorrow (as you mentioned) this would be a warning flag for me regarding what you're delivering. For the immediate issue consider the solution presented by poj.