help, i cant update my image i cant use session because,its admin who is providing the profile of the student,
kindly take a look, what went wrong!
<?php
$pic= $_FILES["piksur"]["name"];
if(isset($_POST['submit']))
{
mysql_query("update students set idno='$_POST[id]',
year='$_POST[year]',
lastname='$_POST[lname]',
firstname='$_POST[fname]',
middlename='$_POST[mname]',
birthplace='$_POST[bplace]',
birthdate='$_POST[bdate]',
religion='$_POST[religion]',
studentcontact='$_POST[scontact]',
studentaddress='$_POST[saddress]',
father='$_POST[father]',
fathercontact='$_POST[fatcon]',
mother='$_POST[mother]',
mothercontact='$_POST[motcon]',
famaddress='$_POST[fam]',
guardian='$_POST[guardian]',
relationship='$_POST[grelation]',
guardiancontact='$_POST[gcontact]',
guardianaddress='$_POST[gaddress]',
pass='$_POST[pass]',
picname='$pic',
prename='$_POST[prename]',
pref='$_POST[pref]',
pree='$_POST[pree]',
elemname='$_POST[elemname]',
elemf='$_POST[elemf]',
eleme='$_POST[eleme]',
dadmitted='$_POST[dadmit]'
where id='$_GET[up_student]'")or die (mysql_error());
if($pic=="")
{
mysql_query("update students set picname='$view[21]' where id='$_SESSION[id]'")or die(mysql_error());
move_uploaded_file($_FILES["piksur"]["tmp_name"], "studentpic/".$_SESSION[id]);
}
else
{
mysql_query("update students set picname='$pic' where id ='$_GET[up_student]'") or die(mysql_error());
move_uploaded_file($_FILES["piksur"]["tmp_name"], "studentpic/".$pic);
}
echo "<script language='javascript'>
alert('Record Updated')
window.location='viewstudent.php';
</script>";
}
?>