On Tuesday 27 August 2002 16:49, Dave Carrera wrote: > Hi All > > I am very fed up and confused to why some simple form error checking is > not working. > > All I want to do is check if a field has something in it the its ok else > show error. > > I have a fields in my form that is for people to upload an image. > > I have tried this.
What does your form look like? > If(!$_POST[img]){ > Do something > } (a) Did you try printing out $_POST[img] to see what it contains? (b) BTW the correct form is $_POST['img'] > Or this > > If(!$_FILE[img]){ > Do something > } Ditto > Or this > > If(empty($_POST[img])){ > Do something > } Ditto etc. > And many other permiatations of these functions but to no avail. All I > get is my error msg whether or not the field has anyhting in it or > nothing but never the desired affect. To find exactly what variables you have to play with you can print_r($GLOBALS). > Its got to be something to do with global vars on switch as if I swith > it off and go back to just calling the var it works a treat. How exactly do you mean by that? The 'superglobals', $_POST, $_GET etc works regardless of the register_globals setting. > This needless to say is giving me a headache as it is vital that I check > the form before posting. > > So any help or guidence will be very much appreciated. Posting your code here would be a step in the right direction. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* If you only have a hammer, you tend to see every problem as a nail. -- Maslow */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php