|Join Nairaland / LOGIN! / Trending / Recent / New|
Stats: 2,869,201 members, 6,886,136 topics. Date: Saturday, 28 May 2022 at 11:15 PM
|Help: Form Data Verification by greatfiso(m): 6:23pm On Oct 26, 2007|
Hope u all had a grt day?
for me, i've been battling this code below all day.
pls i need help on how to verify data from my HTML form
the problem i have with the code below is that it keeps giving me
the error message when the field (which is not required) is empty.
pls a messiah should come to my aid.
// TO CHECK THE DATA COMING IN
$pattern = '([[:digit:]]|[~`!@$%&()_ =+|\:;"/?,]|[|]|-)+';
$name = stripslashes($_POST['ady2']);
alert("Characters such as > * # \" Are NOT Accaptable."
|Re: Help: Form Data Verification by my2cents(m): 7:41pm On Oct 26, 2007|
Apparently, there is something in your regex, otherwise you wouldn't be getting this error. I would do an alert of the value of the (assuming) text field and go from there. Perhaps you should apply trim() to the $name field first b4 stripslashes(), to remove any trailing spaces?
Try what I have suggested in the first paragraph above and let us know if that works or not.
|Re: Help: Form Data Verification by greatfiso(m): 6:28pm On Oct 27, 2007|
your post was more than helpful
the problem was locked around the regex and the $name
got it sorted.
|Re: Help: Form Data Verification by WebMonk(m): 7:14pm On Oct 27, 2007|
@ poster: if you're using Dreamweaver, then all that is a snap. there's and extensive dreamweaver extension that does just that: form validation. with custom messages. it's here:
(remembers the good OLD Days of coding in ASP, then shrugs from the nightmares)
|Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health |
religion celebs tv-movies music-radio literature webmasters programming techmarket
Nairaland - Copyright © 2005 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 53