javascript confirm run php file
<p>I have a javascript confirm box and if the user clicks OK then I want to run a php script. Not sure on how to do this. Below is the javascript code for the confirm box:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function val_name()
 {
        var namePattern = /^[A-Za-z]{3,25}$/;
    if( !namePattern.test(document.upload.fn.value))
            alert("Enter valid first name");

    if( !namePattern.test(document.upload.ln.value))
        alert("Enter valid last name");


        var x=document.forms["upload"]["email"].value;
        var atpos=x.indexOf("@");
        var dotpos=x.lastIndexOf(".");

    if (atpos &lt; 1 || dotpos &lt; atpos + 2 || dotpos + 2 &gt;= x.length)
        {
        alert("Not a valid e-mail address");
        return false;
        }


    else if
        (confirm("Are you sure you want to add this driver?")== true)
        {
        onClick = 'add_driver.php';
        }
}
&lt;/script&gt;
</code></pre>
