Plz help me. I want to insert data in table which is filled by user. But i want to keep that insert query code in same file where i have created my html form. I want not to make insert.php individually.

In this way i want to insert data in my table. so plz help me as sson as possible

Recommended Answers

In the php file first check whether the form was submitted:

<?php
// assumming you use method=post
if(isset($_POST['submit'])) {

    // do the insert

    // display thankyou message

    // end the script
    die();
}

// if the form was not submitted, display it
// ...
?>

<form action="#" …
Jump to Post

All 3 Replies

In the php file first check whether the form was submitted:

<?php
// assumming you use method=post
if(isset($_POST['submit'])) {

    // do the insert

    // display thankyou message

    // end the script
    die();
}

// if the form was not submitted, display it
// ...
?>

<form action="#" method="post">
...

Thank u so much

You are welcome. If you have no more questions regarding this problem, please mark the thread as solved, otherwise we are welcome to leave it open and ask at your own pace. Happy coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.