0

My controller quote.php doesn't work properly. The first view is rendered correctly, but upon submitting a stock symbol (‘FREE’ like in the spec’s example) on this page, the page just reloads instead of showing the second view, quoteView2.php (which for now is just a dummy page containing some text, only for testing if quote.php works). Below is my code for quote.php:

<?php
    require("../includes/config.php"); 

    render("quoteView1.php", ["title" => "Quote"]);

    if ($_SERVER["REQUEST_METHOD"] == "POST")
    {
        $stock = lookup($_POST["symbol"]);

        if ($stock == false)
        {
            apologize("You have entered an invalid stock symbol.");
        }
        else 
        {
            render("quoteView2.php", ["title" => "Quote2Test"]);
        }
    }
?>

What am I doing wrong?

3

This program only ever executes the first two lines (require.. render..). Once you're in, you're out, back to quoteView1.php. Don't you need to call quoteView1.php conditionally? This program only ever executes the first two lines (require.. render..). Once you're in, you're out, back to quoteView1.php. Don't you need to call quoteView1.php conditionally? This program only ever executes the first two lines (require.. render..). Once you're in, you're out, back to quoteView1.php. Don't you need to call quoteView1.php conditionally?

You get the idea.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .