PHP : how to return back to previous page while closing pop up
<p>I have a form submission. While i Click Submit button, will check for mandatory fields and if the fields are blank, I am opening a popup window using javascript to show error message. So once I close the popup I am not going back to previous page Instead it shows a white blank screen.</p>

<p>My code for verification and opening popup is :</p>

<pre><code>&lt;?php 

 if (isset($_POST['submit']))
    { 
if ($task == '' || $comments == '')
 {
 // generate error message
print "&lt;script type='text/javascript'&gt;";
print "window.open('error.php','new_window1','status=1,scrollbars=1,resizable=0,menu=no,width=320,height=220');";
print "&lt;/script&gt;";  

}
else
{
$sql3= "INSERT INTO work (task, comments, assignee, type, priority, dataum1, dataum2, status) VALUES ('$task', '$comments', '$assignee', '$type', '$priority', '$dataum1', '$dataum2', '$status')";
mysqli_query($mysqli,$sql3) or die(mysqli_error($mysqli));
}
}
?&gt; 
</code></pre>
