how to execute a php file by clicking on a buttton?
<p>I've got an HTML page which is like a "leave application form" where there is a button named "Accept"</p>

<p>I've written the PHP code below which needs to be executed when I click on that accept button.</p>

<pre><code>&lt;?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}

mysql_select_db("leave", $con);
$leaveType=$_POST['leavename'];
$totalDays=$_POST['days'];
$EId=$_POST[empid];

$sql="SELECT 
          LFA, SickLeave, TransferLeave, HolidayLeave, AnnualLeave, UnpaidLeave 
      FROM leaverecords 
      WHERE empid='$EId'";

if (!mysql_query($sql,$con))
{
    die('Error: ' . mysql_error());
}

$result=mysql_query($sql);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    $lfa = $row['LFA'];
    $sleave = $row['SickLeave'];
    $tleave = $row['TransferLeave'];
    $hleave = $row['HolidayLeave'];
    $aleave = $row['AnnualLeave'];
    $unpaidleave = $row['UnpaidLeave'];
}

if($leaveType=="LFA")
{
    if( $lfa&gt;0 &amp;&amp; $lfa&gt;=$totalDays)
    {
        $newlfa = $lfa - $totalDays;
        $sql="UPDATE leaverecords SET LFA = '$newlfa' WHERE empid='$EId'";
        if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }  
    }
    else
        echo "Leave not available!";

}    

elseif($leaveType=="Sick Leave")
{        
    $newsleave = $sleave + $totalDays;
    $sql="UPDATE leaverecords SET SickLeave = '$newsleave' WHERE empid='$EId'";
    if (!mysql_query($sql,$con))
    {
        die('Error: ' . mysql_error());
    }        
}    

elseif( $leaveType=="Transfer Leave")
{       
    if($tleave!=5)
    { 
        $newtleave = $tleave + $totalDays;
        $sql="UPDATE leaverecords SET TransferLeave = '$newtleave' WHERE empid='$EId'";
        if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }
    }
    else
        echo "Leave not available!";         
}  

elseif($leaveType=="Holiday Leave")
{        
    $newhleave = $hleave + $totalDays;
    $sql="UPDATE leaverecords SET HolidayLeave = '$newhleave' WHERE empid='$EId'";
    if (!mysql_query($sql,$con))
    {
        die('Error: ' . mysql_error());
    }        
}

elseif($leaveType=="Annual Leave")
{        
    if($aleave&gt;0 &amp;&amp; $aleave&gt;=$totalDays)
    {
        $newaleave = $aleave - $totalDays;
        $sql="UPDATE leaverecords SET AnnualLeave = '$newaleave' WHERE empid='$EId'";
        if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }

    }
    else
        echo "Leave not available!";         
}

elseif($leaveType=="Unpaid Leave")
{       
    if($unpaidleave&lt;90)
    { 
        $newunpaidleave = $unpaidleave + $totalDays;
        $sql="UPDATE leaverecords SET UnpaidLeave = '$newunpaidleave' WHERE empid='$EId'";
        if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }
    }
    else
        echo "Leave not available!";         
}                
?&gt;
</code></pre>

<p>Can anyone please tell me what do I have to do with the button to make the PHP code run when I click it?</p>
