0

I'm doing pset7, quote.php. I created the main logic in quote.php which is in public directory and (if lookup function sends an associative array) then sending the information to other quote.php which is in public directory.

The problem is when ever I submit any symbol it simply refreshes that page and prompt again for symbol.

I've tried every possible thing but these doesn't work. here is my code,

require("../includes/config.php");
render("quote_form.php", ["title" => "stock"]);

if ($_SERVER["REQUEST_METHOD"] == "POST"){
    $stock = lookup($_POST["symbol"]);
    if ($stock == false)
        apologize("Sorry! symbol not found.");
    //else
    render("quote.php", ["stock" => $stock]);
}
else{
    print("Quote");
}

1 Answer 1

1

There is at least one more thing that you did not try :). This program will unconditionally go to quote_form.php. After it executes the require, it is rendering quote_form.php. It never reaches the if test. Let login.php be your guide.

You must log in to answer this question.

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