Q:

Form Submit Button Works, but not Submit() in Link

I've done this so often before on different websites, but can't get it to work now.
I've got a simple form that posts perfectly well using a submit button, but for a specific reason I actually need it to submit via a url link instead.  I'm using submit().  The form submits, but the data isn't posting.
What am I missing?  
<html>
<body>
<?
if(isset($_POST['bar'])) { echo 'testing button<br>'; }
if(isset($_POST['information'])) { 
    echo $_POST['information'];
    echo '</br>Info successfully posted.'; 
    }
?>

    <form action="test.php" method="post" id="fooform"> 
        Hello World.<br>
        Select checkbox: <input type="checkbox" id="information" name="information" value="yes">
        <input type="submit" name="bar" value="Send"><br>
        <a href="test.php" onclick="SubmitForm('fooform');">Confirm and Post</a><br>
        <a href="test.php" onclick="this.form.submit();">Post Directly </a>
    </form>

    <script type="text/javascript">
        function SubmitForm(formId) {
            var oForm = document.getElementById(formId);
            alert("Submitting");
            if (oForm) { oForm.submit(); }
            else { alert("DEBUG - could not find element " + formId); }
            }
    </script>
</body>
</html>

A:

The form starts to submit, then the href of the link is followed, and this cancels the form submission.
If you are using old-style onclick attributes, then return false; at the end to prevent the default action.
You would, however, be better off using a submit button (you are submitting a form). You can use CSS to change its appearance. 

