Jump to content


Photo

commers messing forms up


  • Please log in to reply
1 reply to this topic

#1 master82

master82
  • Members
  • PipPipPip
  • Advanced Member
  • 182 posts

Posted 29 September 2006 - 02:28 PM

I have the following form:

<form action="docalc.php" method="post" name="calcform" target="_self" id="calcform">
    <label>
    <input name="calc" type="text" id="calc" value="<?php echo"$max" ?>" />
    </label>
          <label>
          <input name="Submit" type="submit" id="Submit" value="Submit" />
          </label>
  </form>

But when the data is submitted I get errors because some people enter 500000 for example while other enter 500,000 and others 500'000.

Its these , and ' etc that messup the calculation.

So how do I strip out ANYTHING that is not a number?

I've looked at the php manual webby but I couldnt figure it out (stripslashed etc...)

Anyone able to help?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 September 2006 - 02:52 PM

Prehaps do something like this:
$max = str_replace(array("'", ",", " "), "", $max);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users