0

i want to add a page with html data to show form and get input from user,store it to database and after successful query show next page with massage that the data is inserted successfully.

3
  • And what have you tried so far? Commented Sep 11, 2015 at 6:29
  • We expect some degree of research and effort from your side. We do not code projects for you, but we will help you with a specific problem while developing your project Commented Sep 11, 2015 at 6:49
  • You have two answers, very broad and not that specific to your whole task. But certainly they both lead to a solution: one with custom code in a template, that can be published with WordPress itself in any page that you want, another one showing how to load WP funcionality in a separate script giving you access to all functions. A bit of effort on your part taking from that answers could spark more interest and helping you in case you get stuck at some point. Commented Dec 15, 2021 at 7:00

2 Answers 2

1

Firstly your question shows no research or effort whatsoever. Also it isn't elaborated efficiently.

From what I gather you want a page with some code in wordpress. There are multiple ways to do it.

Easiest way would be to create a new page template in your theme file. Go to your active theme folder and create a new page template

<?php
/* Template Name: Form Page Template */

    if($_POST['xyz') {
    //Post form processing and data insertion here
    }
    ?>
    <form name="abc" method="POST" action="">
    <input type="text" name="xyz" />
    <input type="submit">
    </form>

    <!---You can add any html or PHP code to Page template ---->

After saving the template file. Go to pages->add new page in dashboard and create a new page . From page attributes drop down choose the page template you just created.

1

As I understood you want an external PHP page that can access WordPress functionality without showing any output or template elements. In this case you just need to include wp-load.php to your code. Supposing that Wordpress were installed your root folder just simply add

require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.