// configuration
    if ($_SERVER["REQUEST_METHOD"] == "GET")
        // else render form
        render("quote_form.php", ["title" => "Quote"]);

    // else if user reached page via POST (as by submitting a form via POST)
    else if ($_SERVER["REQUEST_METHOD"] == "POST")
        apologize("Please enter the stock symbol.");
        $stock = lookup($_POST["symbol"]);
            apologize("Invalid symbol.");

        render("quote_output.php", ["price" => number_format($stock["price"], 2, '.', ',')]);

  • So if we're reading this correctly, quote_output.php is contained in a separate file that is so-named, and consists solely of the line <p>Price:<?=htmlspecialchars($message)?></p> ?
    – ronga
    Commented Jun 26, 2016 at 13:38
  • Yes.Just like apology.php. Commented Jun 26, 2016 at 18:43

1 Answer 1


Assuming you have the necessary headers (which you don't show in the above code snippet) in your quote_output.php file, your problem is the fact that it contains an undefined variable $message, which was not passed in via your render function.

  • Could you be a little specific regarding those headers(i have just one line of code in quote_output)? apology.php did not contain anything.And i surmise $message is passed on by the render function itself. Commented Jun 27, 2016 at 18:29
  • Your browser will not recognize this as html 5 unless your code starts with the <!DOCTYPE html> header and ends with </html>. Also, what does $message contain? It's not defined in quote, nor do you pass it in via render, as you did with price.
    – ronga
    Commented Jun 28, 2016 at 1:50
  • It works now.Should be &price. Commented Jul 4, 2016 at 19:55

You must log in to answer this question.

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