How to fix undefined error in php -


i have problem fix type error, declare variable given problem.

this complete file:

$success=''; $error1=''; $valid_exts = array('jpeg', 'jpg', 'png', 'gif');  $max_file_size = 2000* 1024; #200kb  $nw = $nh = 50; # image # height  if(isset($_request['submit']))   {     $title=$_request['title'];     $date=date('d-m-y');     /****prod image*******************************/     $fn1=$_files['image']['name'];      $fs1=$_files['image']['size'];      $ftemp1=$_files['image']['tmp_name'];      $img_type1=$_files['image']['type'];      if(! $_files['image']['error'] && $_files['image']['size'] < $max_file_size) {         $ext = strtolower(pathinfo($_files['image']['name'], pathinfo_extension));          if (in_array($ext, $valid_exts))         {             // check if file exists             $path = 'image/thumb/'.$fn1;             $size = getimagesize($_files['image']['tmp_name']);              $x = (int) $_post['x'];             $y = (int) $_post['y'];             $w = (int) $_post['w'] ? $_post['w'] : $size[0];             $h = (int) $_post['h'] ? $_post['h'] : $size[1];              $data = file_get_contents($_files['image']['tmp_name']);             $vimg = imagecreatefromstring($data);             $dstimg = imagecreatetruecolor($nw, $nh);             imagecopyresampled($dstimg, $vimg, 0, 0, $x, $y, $nw, $nh, $w, $h);             imagejpeg($dstimg, $path);             imagedestroy($dstimg);              if(move_uploaded_file ($ftemp1,"image/$fn1")){                 $result="insert add_banner values ('','$title','$fn1','$date')";                 if(mysql_query($result)){                      //echo "<script>alert('banner added !');</script>";                     $success='<div class="alert alert-success" role="alert"><strong>well done!</strong> add banner.</div>';                      // echo "<script>document.location.href='front_banner.php'</script>";                 } else {                     $error1='<div class="alert alert-danger" role="alert"><strong>oh snap!</strong> change few things , try submitting again.</div>';                     //echo "<script>document.location.href='front_banner.php'</script>";                 }             } else {                 $error1='<div class="alert alert-danger" role="alert"><strong>oh snap!</strong> change few things , try submitting again.</div>';                 //echo "<script>document.location.href='front_banner.php'</script>";             }         } else {             $error1='<div class="alert alert-danger" role="alert"><strong>oh snap!</strong> sorry, jpg, jpeg, png & gif files allowed.</div>';                  }     } else {         $error1='<div class="alert alert-danger" role="alert"><strong>oh snap!</strong> sorry, please fill field</div>';     } } 

this output:


notice: undefined index: x in e:\xampp\htdocs\novus_admin_panel\web\front_banner.php on line 28

notice: undefined index: y in e:\xampp\htdocs\novus_admin_panel\web\front_banner.php on line 29

notice: undefined index: w in e:\xampp\htdocs\novus_admin_panel\web\front_banner.php on line 30

notice
: undefined index: h in e:\xampp\htdocs\novus_admin_panel\web\front_banner.php on line 31

what doing wrong?

<?php if(isset($success)) { echo $success ; } .''.if(isset($error1)) { echo $error1 ;}.''.if(isset($error)) { echo $error;}?> 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -