I have a little problem, well duh. Anyway, I can't figure out how to have php tell if :
<input type="file">
is set when the form is submitted.
the form is multi part, it has a file and some text fields
i have tried strlen and some other things and they wont work either.
here is the page:
<?PHP
include("dblib.php");
include("memlib.php");
$message = " ";
$page = "info";
CHECK COOKIE-->
if(isset($famname) && isset($fampass) )
{
if (!($row_array = checkCook($famname, $fampass) ) )
$message .= "wrong password";
}
else
{
header("Location: login.php");
}
global $link;
$query4 = "SELECT id FROM members WHERE login='$famname'";
$result4 = mysql_query($query4);
while(list($id) = mysql_fetch_row($result4))
{
if (isset($action) && $action == "info")
{
if(isset($picture))
{
$data = addslashes(fread(fopen($picture, "r"), filesize($picture)));
global $link;
$query = "UPDATE members set mail='$mail', firstn='$firstn', lastn='$lastn', age='$age', gender='$gender', location='$location', job='$job', pic='$data', filetype='$picture_type' WHERE login='$famname'";
$result = mysql_query($query, $link);
if ( ! $result )
die("Updating Error");
header("Location: menu.php");
exit;
}
else
{
global $link;
$query = "UPDATE members set mail='$mail', firstn='$firstn', lastn='$lastn', age='$age', gender='$gender', location='$location', job='$job', WHERE login='$famname'";
$result = mysql_query($query, $link);
if ( ! $result )
die("Updating Error");
header("Location: menu.php");
exit;
}
}
}
include("nav.inc");
global $link;
$query = "SELECT firstn, lastn, age, gender, location, job, mail, id FROM members WHERE login='$famname'";
$result = mysql_query($query);
while(list($firstn, $lastn, $age, $gender, $location, $job, $mail, $id) = mysql_fetch_row($result))
{
?>
<BODY BGCOLOR=5D69FD link="#000000" vlink="#000000" alink="#000000" text="#000000">
<FONT FACE=VERDANA SIZE=2>
<FORM enctype="multipart/form-data" method="post">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="info">
<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" value="20000">
<BR>
General Info
<BR>
First Name:
<BR>
<?PHP
print ("
<input type=text name=firstn value=\"$firstn\" $signstyle maxlength=\"40\">
");
?>
<BR>
Last Name:
<BR>
<?PHP
print ("
<input type=text name=lastn value=\"$lastn\" $signstyle maxlength=\"40\">
");
?>
<BR>
Age:
<BR>
<?PHP
print ("
<input type=text name=age value=\"$age\" $signstyle maxlength=\"2\">
");
?>
<BR>
<BR>
Gender:
<BR>
<?PHP
print ("
<input type=text name=gender value=\"$gender\" $signstyle maxlength=\"1\">
");
?>
<BR>
Location:
<BR>
<?PHP
print ("
<input type=text name=location value=\"$location\" $signstyle maxlength=\"40\">
");
?>
<BR>
Occupation:
<BR>
<?PHP
print ("
<input type=text name=job value=\"$job\" $signstyle maxlength=\"50\">
");
?>
<BR>
WHAT IS THY EMAIL, MY MASTER?
<BR>
<?PHP
print ("
<input type=text name=mail value=\"$mail\" $signstyle maxlength=\"50\">
");
?>
<BR>
<BR>
Personal Pic: (leave alone unless your changing it)
<BR>
<input type=file name="picture" <?PHP print $signstyle; ?>>
<BR>
<BR>
<INPUT TYPE="Image" SRC="http://bj-land.com/i/img/go.gif" width="100" height="35">
</form>
<?PHP
}
?>
Everything works if you have a picture file, but how can i make it work if you dont?