PDA

View Full Version : help for validating forms



chandni
07-04-2006, 11:31 AM
hi can some pls pls help me validating this form...i have been struggling hard to write a php script but always something goes wrong...this is the url... WWW.LEXIMINDIA.COM (http://www.LEXIMINDIA.COM) i would be very thankful if some can write a script for me pls...
many thanks
chandni

Andy128
07-04-2006, 11:55 AM
chandni-

What you are asking is very involved and is not a simple thing. To get it right, and professional, I recommend that you look at this;

http://www.vodahost.com/vodatalk/free-classifeds/8122-form-scripting-service.html

There is quite a bit of work there- for example, your form does not have a submit button. Aside from that, this extensive of a form needs validation for required fields and security measures in the script. Watdaflip would be my choice for something like this.

Cheers,

Andy

nbop
07-04-2006, 07:15 PM
If i where you I would use javascript for the validation.
You can find some help on this topic at Form Validation : Introduction - JavaScript Tutorial - EchoEcho.Com - Beginners best choice! (http://www.echoecho.com/jsforms.htm)
You could also use php, but your page would have to be reloaded everytime somthing isn't right. I think javascript is the easiest solution for you.

Andy128
07-04-2006, 07:31 PM
nbop,

I tend to disagree. 1- what happens if javascript is turned off? 2- PHP is a server side script and therefore the validation/security measures are unseen which makes it harder to hack.

While I agree that javascript can do the job- it has it's limitations.

As to the re-load, using the back button or a return to previous page button will keep all previously entered content in the form fields.

Just another point of view.

Cheers,

Andy

Andy128
07-05-2006, 01:30 AM
chandni-

What e-mail address would you have the form info sent to?

Have you resolved this issue?

Andy

nbop
07-05-2006, 09:42 AM
@andy128: well i don't think his form has to be extremely secure and if he wants to use php he would have to learn regex. This is harder then the javascript solution. You can always force the user to allow javascript.
The best way is using javascript and php. But I think php is a little to hard for chandni. I wouldn't pay someone to make a script for me but search for a solution myself. This way you learn and save money. (It does use time :p)


@chandi: try google. Search for php regular expressions.

navaldesign
07-05-2006, 11:03 AM
If your main job does not allow you the time to do it yourself, then Watdaflip's Form Scripting Service (http://www.vodahost.com/vodatalk/free-classifeds/8122-form-scripting-service.html) is the best solution. I've been writing scripts for many members, including validation and upload. Your script is relatively easy, but only if you have some experience.

nbop: ANY form that sends an email, is a potential spammer target. Even a simple Tell a Friend form. Chances are less than 5% that a form may actually be hijacked, but why risk?

nbop
07-05-2006, 01:51 PM
Lol so u want to protect form hijacking with validating it's input? If you want to protect against hijacking you need to use php: sessions or cookies. But for simply checking if a form is empty, email is vailid, numer is number you can use javascript. This way is faster (page dosn't need to actually be submitted or reloaded) so user friendlier.
Owja you might want to use a captcha (you know, an image with contents that you need to type in a textbox) against bot spam.

navaldesign
07-05-2006, 02:07 PM
nbop: I think we have a missunderstanding here. Form security has been an issue during the last two months - obviously you weren't around at that time. If you were you would have seen that we are talking excactly about php, and, since we should use it for that purpose, we might as well use it for validation also.