Re: [PHP] Validate if the field of a form is empty
It works fine for me, foreach ( $_FILES['archivo']['name'] as $file ) { //echo $file; } if($file == ""){ echo "empty"; }else{ //continue... } Thanks a lot Jim! Te0
Re: [PHP] Validate if the field of a form is empty
te0t3l wrote: > Hi, I need to validate a field that work with Multifile plugin of Jquery, > I want to check if the field is empty with php. > > [code] > > > [code] > > I've tried different ways but it does not work: > for example: > $field = $_FILES["archivo"]["name"]; > $field = $_FILES["archivo[]"]["name"]; > > i dont know how to validate it, any help would be appreciated. > > Thanks, > To see what is happening, look at the output of print_r($_FILES); But, you should be doing it like this. foreach ( $_FILES["archivo"] AS $file ) { $field = $file['name']; ... } -- Jim Lucas A: Maybe because some people are too annoyed by top-posting. Q: Why do I not get an answer to my question(s)? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validate + if
If your "onClick" handler returns true (or is it false?) in JS, the action won't happen. Or something like that. Google for it. And you still need to validate server-side, as JS is easily bypassed. On Sat, February 23, 2008 1:01 pm, Emiliano Boragina wrote: > Hi list! > > > > I have a form. > > I validated it with javascript. > > Do the validation, but send the form information. > > How can I prevent send the information and stay in the form? > > When validate all correctly send the info, but if the form isnt > complete > correctly dont send. > > > > Thanks! > > > > + > _ >// Emiliano Boragina _ > >// Diseño & Comunicación // > + > _ > >// [EMAIL PROTECTED] / >// 15 40 58 60 02 /// > + > _ > > > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] validate + if
> From: [EMAIL PROTECTED]> To: php-general@lists.php.net> Date: Sat, 23 Feb > 2008 16:01:08 -0300> Subject: [PHP] validate + if> > Hi list!> > > > I have a > form.> > I validated it with javascript.> > Do the validation, but send the > form information.> > How can I prevent send the information and stay in the > form?> > When validate all correctly send the info, but if the form isn’t > complete> correctly don’t send.> > > > Thanks!> > > > + _> // Emiliano > Boragina _> > // Diseño & Comunicación //> + _> > // [EMAIL > PROTECTED] /> // 15 40 58 60 02 ///> + _> > > Return false from the form validation if it fails and call if with the form's onSubmit function returning false will stop the submission bastien _