javascript alert before php code
<p>page:content display.php</p>

<pre><code>&lt;td width="100"&gt;&lt;a onclick="return confirmSubmit()" href="delete.php?id=&lt;?php echo $row['id']; ?&gt;&amp;table=labour_details&amp;return=content_display.php"&gt;&lt;img src="../images/delete.png" border="0" alt="delete"&gt;&lt;/a&gt;&lt;/td&gt;
</code></pre>

<p>page:delete.php</p>

<pre><code>if(isset($_GET['id']) &amp;&amp; isset($_GET['table']))
    {
        $id=$_GET['id'];
        $tablename=$_GET['table'];
        $return=$_GET['return'];




        if($tablename=="labour_details")
        {
                    $sql=mysql_query("SELECT * FROM `labour_details` WHERE `id`='$id'");
                    $row_1=mysql_fetch_array($sql);
                    $labour_name= $row_1['labour_name'];

                    if($labour_name!="")
                    {
                        $str=mysql_query("DELETE FROM `labour_details` WHERE `id`='$id'");
                        if($str)
                        {
                            header("location:$return?msg=Record Deleted Successfully!&amp;id=$id");
                        }else{
                            echo "Problem in deleting :";
                        }
                    }

        }

}
</code></pre>

<p>my problem is where to add alert so that before deleting record it show javascript massage if allow then it will delete record.</p>

<pre><code>function confirmSubmit()
{
    var agree=confirm("Are you sure you wish to Delete this Entry?");
    if (agree)
        return true ;
    else
        return false ;
}
</code></pre>
