My php script is auto refreshing on submit and it shouldnt be doing this. http://monstarcoders.com/test/port-upload.php you can view the script there you will noticed when an error is found it will auto clear the boxes. I don't want this. <form id="form" name="form" method="POST" enctype="multipart/form-data"> <input type="file" name="userfile" /> <input type="text" name="title" value="<?$_GET['title'];?>"/> <input type="text" name="website"/> <input type="text" name="job"/> <input type="text" name="developers"/> <input type="submit" name="upload" value="Submit" class="upload_b" /> </form> <? include('config.inc');?> <?php include('setting.php');?> <? $divd = 1024; $isize = $maxsize / $divd; $isize2 = round($isize); ?> <? if($_POST['upload']){ if(is_uploaded_file($_FILES['userfile']['tmp_name'])){ if($_FILES['userfile']['size']>$maxsize){ echo 'File size is to big'; die; } } if (empty($_POST['title'])){ echo 'Title box is empty'; die; }else if (empty($_POST['website'])){ echo 'Website box is empty'; die; }else if (empty($_POST['job'])){ echo 'Job box is empty'; die; }else if (empty($_POST['developers'])){ echo 'Developers box is empty'; die; } if(!$_FILES['userfile']['name'] || $_FILES['userfile']['name'] == ""){ echo 'Please select a file.'; }elseif(($_FILES['userfile']['type']=="image/gif") || ($_FILES['userfile']['type']=="image/pjpeg") || ($_FILES['userfile']['type']=="image/jpeg") || ($_FILES['userfile']['type']=="image/jpg") || ($_FILES['userfile']['type']=="image/png") || ($_FILES['userfile']['type']=="image/bmp") || ($_FILES['userfile']['type'])=="image/swf") { $randlink = rand(1,9); $randlink2 = rand(1,26); $ranletters = array("1" => "aur", "2" => "jef", "3" => "keh", "4" => "udj", "5" => "yke", "6" => "qik", "7" => "epl", "8" => "xnk", "9" => "wjo"); $ranletters2 = Array("1" => "a", "2" => "b", "3" => "c", "5" => "e", "6" => "f", "7" => "g", "8" => "h", "9" => "i", "10" => "j", "11" => "k", "12" => "l", "13" => "m", "14" => "n", "15" => "o", "16" => "p", "17" => "q", "18" => "r", "19" => "s", "20" => "t", "21" => "u", "22" => "v", "23" => "w", "24" => "x", "25" => "y", "26" => "z",); $randsel = $ranletters[$randlink] . time() . $ranletters2[$randlink2]; // Upload Process $target="/home/dangys/monstarcoders.com/"; $file = $_FILES['userfile']['name']; $new_build = $randsel.substr($file, strrpos($file, ".")); $res = move_uploaded_file($_FILES['userfile']['tmp_name'], $target.$path.$new_build); if(!$res){ echo 'Upload Failed, Please try again'; }else{ // Set Url Variables $imgf = $new_build; $urlf = 'http://' .$domain .'/' .$path .$imgf; $thumb = 'http://' .$domain .'/' .$path.$tpath.$imgf; chmod("./" . $path . $imgf,0777); $date = date("Y-m-d H:i:s"); mysql_query("INSERT INTO portfolio (Images,Url,Thumbnail,Date) VALUES('$imgf', '$urlf', '$thumb', '$date')") or die(error); }?> <? include('links.php'); ?> <?php }else{ echo 'File type is not allowed.'; } echo 'file uploaded!'; } ?> <? include('bmp.php'); if(isset($_POST['upload'])){ copy($path.$imgf,$path.$tpath.$imgf); $uploadedfile = $_FILES['userfile']['tmp_name']; $ext = @strtolower(end(explode('.', $urlf))); if($ext == "jpeg" || $ext == "jpg"){ $src=@imagecreatefromjpeg($path."/".$tpath."/".$imgf); }elseif($ext == "gif"){ $src=@imagecreatefromgif($path."/".$tpath."/".$imgf); }elseif($ext == "png"){ $src=@imagecreatefrompng($path."/".$tpath."/".$imgf); }elseif($ext == "bmp"){ $src=@imagecreatefrombmp($path."/".$tpath."/".$imgf); }elseif($ext == "swf"){ echo 'Swf is currently not able to be resized'; } list($width,$height)=@getimagesize($path."/".$tpath."/".$imgf); $imagewidth='250'; $imageheight='143'; if($width >= $imagewidth ){ $newwidth=$imagewidth; $newheight=$imageheight; $tmp=@imagecreatetruecolor($newwidth,$newheight); @imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = "$path"."$tpath". $imgf; @imagejpeg($tmp,$filename,100) or die("Can't save image"); } } ?> <? $data_p = mysql_query("SELECT * FROM `portfolio` ORDER BY `Date` DESC limit 6") or die(mysql_error()); $total = mysql_num_rows($data_p); if ($total >= 1) { while($info = mysql_fetch_array( $data_p )) { ?> <a href="<? echo $info['Url']; ?>"><img src="<? echo $info['Url']; ?>" height="122px" width="169px" border="0" alt=""/></a> <? } } ?> PHP: