Re: Check the contents of a file field

From: Date: Mon, 05 May 2003 23:21:26 +0000
Subject: Re: Check the contents of a file field
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-146468@lists.php.net to get a copy of this message
Thanks for your replies Jennifer, but using this code, i still get a message saying 'Please complete all fields' if($_POST[document] == ''){ $error = "Please complete all fields"; header ("Location: add_document.php?error=$error&project_id=".$_GET[project_id]."&project_name= ".$_GET[project_name].""); exit; } Any suggestions? "Jennifer Goodie" <goodie@apollointeractive.com> wrote in message news:NEBBIJJIKBGCCCNKMPBCOEEMHGAA.goodie@apollointeractive.com... > If you are checking before you submit the form, you need to use javascript. > If you are checking after the form is submitted you use PHP. The PHP answer > has already been given. The javascript way would be something like > if(document.forms[0].fieldname.value == ''){ > alert "The file field was not filled out." > return false; > } > > Of course your form might not be form[0] and your field is probably not > called fieldname and I am not the Queen of Javascript, so you'll probably > need to test this. But it is not like this is the javascript help list, > anyway. > > > -----Original Message----- > > From: shaun [mailto:shaun@mania.plus.com] > > Sent: Monday, May 05, 2003 3:44 PM > > To: php-general@lists.php.net > > Subject: Re: [PHP] Check the contents of a file field > > > > > > Thanks for your reply, but I am actually just trying to test whether the > > field was left empty before submitting the form... > >

« previous php.general (#146468) next »