How to submit a form without a submit button in php?

Hii,
I am just create a form using php and i want to submit a form but without using submit button.Instead i want to use label.How can i do that?
Thanks.

3 Replies

IS Ishan Shah January 24, 2020 01:47 PM UTC

As you suggest, We Can Submit a form without the submit button using " Div block in Html web form page ". 

The Code is the following : 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Submit Without Submit Button</title>
    <script>
        function submitForm() {
            document.getElementById("subForm").submit();
            alert("You Form Is Submitted Successfully");
        }
    </script>
</head>

<body>
    form method="post" action="formController.php" id="subForm">
    <input type="text" name="txtName" placeholder="Enter Your Name" /><br />
    <input type="text" name="txtEmail" placeholder="Enter Your Email" /><br />
    <input type="text" name="txtMobile" placeholder="Enter Your Mobile" /><br />
    <textarea name="areaReply" placeholder="Enter Your Address"></textarea>
    </form>
    <div onclick="submitForm()" style="color:green;">Submit</div>
</body>

</html>


IS IsabellWelsh January 26, 2020 09:28 PM UTC

Did it work? As I can't resolve the problem with this help.


DJ Davis Jebaraj Syncfusion Team January 27, 2020 02:14 PM UTC

Hi Isabell,

Please check this discussion on Stack Overflow for some ways to resolve potential issues with this code.


Regards,

Davis

Loader.
Up arrow icon