0

I am creating a calculator within a wordpress theme I have made, the code looks like this;

<?php //Template Name: Quote ?>
<?php get_header(); ?>
<section>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <article>
                    <h1><?php the_title(); ?></h1>
                    <div class="post">
                        <form method="post" action="<?php bloginfo('template_url') ?>/quote.php">

                            Counter 1: <input type="text" name="counter1width"> x <input type="text" name="counter1depth"><br>

                            <input type="submit" name="submit" value="Calculate Now">
                        </form>

                        <?php
                            if(isset($_POST["submit"])) {
                                $counter1width = $_POST["counter1width"];
                                $counter1depth = $_POST["counter1depth"];

                                echo $counter1width*$counter1depth;
                            }

                        ?>
                    </div>
                </article>
            </div>
        </div>
    </div>
</section>
<?php get_footer(); ?>

This is the error message I get...

Fatal error: Call to undefined function get_header() in /home/landford/public_html/wp-content/themes/landfordstone/quote.php on line 2

1 Answer 1

1

You can no call the qoute.php file directly.

1) create new page template and in that page template write your code.

2) Create new Page and select the page template from dropdown.

3) Add that page url in form action.

Sign up to request clarification or add additional context in comments.

Comments

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.