| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
I like Iced Tea
|
Another Validation
SOrry for all these validations! I promise this will be the last one! This one is for credit cards. I looked up all these things on google and non that were very useful for me. PHP Code:
I came up with this. But it doesnt work... no wonder since I made it. Soo im trying to write a statment where IF the type of card equals = CARD VALUE then CARD NUMBER must = XXXXXXXXXXXX.... How do you write a "then" in php? echo?... HELP ME! |
|
|
|
|
|
#2 (permalink) |
|
gotsa a malanga!
Join Date: Apr 2006
Location: ottawa, canada
Posts: 489
|
err not why something like (didn't check your regex or anything) PHP Code:
|
|
|
|
#4 (permalink) |
|
I like Iced Tea
|
PHP Code:
I have all my values right.. and everything. Can anyone explain my error in this code? since it doesnt work... hmmmmmx. Any help to make this work is appriciated! The validation completely skips this code and this code does nothing... even with letters in the text field! Help please =)!! |
|
|
|
#7 (permalink) |
|
I like Iced Tea
|
My $typecard is a select field. Soo there are only those 3 options. HTML Code:
Might I have to add something to this? or change my php to incorporate this? |
|
|
|
#8 (permalink) |
|
I like Iced Tea
|
OHHHHH SOOOO STUPID! OMFG! seriously. I spent a whole crap load of hours and just found out my php was like this: PHP Code:
with that stupid space between typecard and ' ...... GRRRRRRR thanks for the help guys!. happy holidays. =) |
|
|
|
#9 (permalink) |
|
I like Iced Tea
|
New problem I can't seem to solve... PHP Code:
When I put in a test which configures to a vaild creditcard. It says its invalid! ???!!! for visa I tried 4000000000000 and that should show as valid. And for mastercard I tried 5100000000000000. These didnt work!! |
|
|
|
#10 (permalink) | |
|
Grumpy old man
Join Date: Oct 2007
Location: North Japan
Posts: 1,692
|
Quote:
They're pretty straightforward when you break them down into the individual parts. They just look intimidating when you see that long string of gibberish like: /<([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1>/ (this one matches opening and closing pairs of HTML tags by the way). It's really worth learning the syntax because regexs are enormously powerful, and brilliantly efficient. To use an analogy, I think of it in the same way as a mixing desk in a recording studio. A long long time ago I studied sound engineering and had a part time job in a studio. Our main desk at the time was a 64 channel affair which like the desks in many studio control rooms gave a lot of visitors that 'bloody hell, how do you understand that thing?' kind of vibe. ![]() It looks intimidating until you realize that the vast majority of the desk is just exactly the same row of buttons duplicated 64 times. Even though it's plainly obvious, a lot of people just look at it and don't see that because they're overwhelmed by the apparent complexity of what is in front of them. You learn how to use one channel strip, and you've mastered 90% of what the desk does. In the same way, regular expressions, while not quite the same as a mixing desk, are just a bunch of symbols which carry out fairly simple functions but when combined, can appear unintelligible. Once you can understand the basic principles, reading and constructing regexs is a lot simpler than it looks. |
|
|
|
|
#11 (permalink) |
|
I like Iced Tea
|
Thanks for that hunch!! nice... Ive got the basic idea =) and I fixed my problem by using !pre_match. But now im confused with this PHP Code:
Because is means, the first number is a 4, then there must be 12 or 15 numbers between 0-9 after the 4. For some reason its working like 12-15. So insted of a number 12 or 15 digits long, it works as a number between 12 and 15 digits. Including 13 and 14 digits... ? is this what its suppost to do? because I put in 4 + 6 other digits, invalid! perfect. Then 4 + 12 other digits, vaild! perfect. then 4 + 14 digits, vaild!? not perfect!!!. and then 15 digits is vaild and after 15 its not which is correct. But why is it vaild with 13 and 14 digits??? shouldnt the comma ',' make it 12 or 15 and not between 12 and 15!. |
|
|
|
#12 (permalink) |
|
I like code.
|
Yes {12,15} matches anything bewteen 12 and 15 chacters long. Though this will match ones that are either 12 or 15 numbers long, no more, no less. Code:
Code { for thought }
"My programs never have bugs, they just develop random features." |
|
![]() |