Hi
I wonder if any body can help me, i am checking to see if the required fields in a HTML form are filed in. I have managed to check the (input type="text") fields, but when i try to check an (input type="file") field as been input it just ignores it. Here is my error checking:
// set up error list array
$errorList = array();
$count = 0;
// validate text input fields
if (!$product) { $errorList[$count] = "Please input Product name"; $count++; }
if (!$form_data) { $errorList[$count] = "Please input a Picture"; $count++; }
// check for errors
// if none found...
if (sizeof($errorList) == 0)
{
MYSQL_CONNECT("$host","$user","$pass");
mysql_select_db("$db");
blah, blah blah......
}
else
{
// errors found
// print as list
echo "The following errors were encountered:";
echo "<ul>";
for ($x=0; $x<sizeof($errorList); $x++)
{
echo "<li>$errorList[$x]";
}
echo "</ul><a href=javascript:history.back(-1)> go back</a>";
}
I just cant figure out how to check the variable $form_data as its from an <input type="file" name="form_data">
Thanks in advance
Stu