Note that there are some explanatory texts on larger screens.

plurals
  1. POerror in form submission without image
    text
    copied!<p>I have a html form and i used it to upload a picture to server</p> <pre><code> &lt;form id="form1" name="form1" method="post" action="testimage.php" enctype="multipart/form-data" &gt; &lt;table width="1000" border="0"&gt; &lt;tr&gt; &lt;td width="108"&gt;ID&lt;/td&gt; &lt;td width="229"&gt; &lt;input type="text" name="id" id="id" value="&lt;?php if(isset($_GET['editcat'])){echo $_GET['editcat'] ;}; ?&gt;" tabindex="1" /&gt; &lt;/td&gt; &lt;tr&gt; &lt;td&gt;Image&lt;/td&gt; &lt;td&gt;:&lt;/td&gt; &lt;td&gt;&lt;input type="file" name="image" id="image" tabindex="7" /&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;User&lt;/td&gt; &lt;td&gt;:&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="user" id="user" value="&lt;?php echo $user ; ?&gt;" tabindex="8" /&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;?php if(isset($_GET['editcat'])){ ?&gt; &lt;input name="editcat" type="hidden" value="set" /&gt; &lt;?php }?&gt; &lt;/td&gt; &lt;td&gt;&lt;input type="submit" name="submit" id="submit" value="Add/Edit" tabindex="9" /&gt; &lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>I retrieve this form data by a php file </p> <pre><code> &lt;?php session_start(); $user_name = $_SESSION['username']; $user_pass = $_SESSION['password']; if ( $user_name == '' ) { header('location:login.php'); exit(); } ?&gt; &lt;?php require_once('connection.php');?&gt; &lt;?php require_once('function.php');?&gt; &lt;?php $err = 0; if(!isset($_SESSION['msgback'])){ $_SESSION['msgback'] = array(); }else{ unset($_SESSION['msgback']); $_SESSION['msgback'] = array(); } if(isset($_POST['id'])){ $id = $_POST['id']; }else{ $id = ""; }if(isset($_POST['user'])){ $user = $_POST['user']; }else{ $user=""; } if(!empty($_FILES['image'])){ $name= basename($_FILES['image']['name']); move_uploaded_file($_FILES["image"] ["tmp_name"],"Hants/admin/uploads/fron_sect/$name")or die(mysql_error()); } ?&gt; &lt;?php ///// if(isset($_POST['editcat'])){ if($err == 0){ if($_POST['id'] == ""){ $_SESSION['msgback'][] = "empty id"; } if(empty($_SESSION['msgback'])){ $user_query = " UPDATE pro_category SET `image`='$name', `update_user`='$user' WHERE `id`='$id'"; $user_result = mysql_query($user_query) or die(mysql_error()); $_SESSION['msgback'][] = "Product category is updated sucesfully."; header('location:product_cat.php'); } } } ////////Inserting a new Iteme//////// if(!isset($_POST['editcat'])){ echo "editcat not set" ."&lt;br/&gt;"; if($err == 0){ if($_POST['id'] == "") { $_SESSION['msgback'][] = "empty id"; } if(empty($_SESSION['msgback'])){ $user_query = "INSERT INTO `pro_category` (`section_id`,`category_name`,`description`,`position`,`visible`,`image`,`pro_view`,`update_user`) VALUES('{$secid}','{$catnam}','{$descrptn}','{$pstion}','{$visble}','{$name}','{$proview}','{$user}') "; $user_result = mysql_query($user_query) or die(mysql_error()); //if(mysql_affected_rows()){ //$_SESSION['user_name'] = $username; $_SESSION['msgback'][] = "Successfuly Added"; header('location:product_cat.php'); //} }else{ $_SESSION['msgback'][] = "Not Successfuly Added"; header('location:product_cat.php'); //redirect_to("product.php?msgback=msgerr"); } } } ?&gt; </code></pre> <p>this code is working well when I select a image to upload. but in some cases i don't need to upload the image but rest of the form field must uploaded in to the server. When i try to submit form without selecting a image it shows me a blank page and nothing happen. i can't figure it out where is the error is. if someone can help me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload