Wednesday, 9 November 2011

How To Submit form without Submit Button

Step 1 : Save Below Script any name ex : ( abc.html )

<script>

function submitForm()
{
    if(document.formName.name.value==''){
        alert("Please Enter the name");
        document.formName.name.focus();
        return false;
    }else{
        document.formName.submit();
    }    
}
</script>
<body>
<form method='post' name="formName" action="formaction.php">
Enter Name & Press Tab : <input type="text" id="name" name="name" onBlur="return submitForm();" />
</form>
</body>




<?php
echo "Thank You ".$_POST['name']." Your Form is Submited.";
?>

1 comment: