Jump to content

squaringkarma

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

squaringkarma's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi again. What's a common way of verifying someone has entered their initials? My thought process was this: Person enters their name in three separate fields on a form: First Name, Middle Initial, and Last Name. [other fields not relating to this question.] Person enters their initials in a field called Initials. If they didn't enter a Middle Initial, I ask them to enter in an * where it would be. I would then take a substring of the First Name, Middle Initial, and Last Name fields and put them into an array. If they didn't enter a Middle Initial, I would somehow put the default value of that substring as an *. I would then use implode to convert the array to a string. Then I would compare the new string to the value of the field Initials. ...But I was wondering if there was a simpler/more intuitive way of doing the task. Hopefully my way made sense?
  2. Hm thanks. mgallforever, when I try with is_int, I always get false. I presume this is because it's form input and it's reading it as a string. I guess my next question would be how do you convert a string into a number? (Though the ctype_digit is accepting strings as input, so maybe the answer to my question isn't necessary.)
  3. How would you validate a form to make sure a user entered in a number for a specific field? I'm blanking on that right now. I'm working on a site where there are 3 different forms depending on what a user inputs for their age. If the user does not enter their age, I want the initial form to reappear with an error of "Please enter your age." Right now, the initial form only appears when the trimmed string length for the field is 0.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.