Jump to content


Photo

accepting an "int" from a form?


  • Please log in to reply
2 replies to this topic

#1 gk20

gk20
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 08 March 2006 - 03:23 PM

I'm accepting a variable from a user in a form called phonenum that is of type INT my database.
I want to make it work so that if the user enters a space in between numbers e.g. between area code
and number that it will work?
For example if user enters 0095 123456 instead of just 0095123456? How will this work?

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 08 March 2006 - 03:26 PM

You could use the str_replace() function to get rid of the space:
</php $var = str_replace(' ','',$_POST['phone']); ?>

Ken

#3 gk20

gk20
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 08 March 2006 - 03:50 PM

Cheers for that, worked perfectly!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users