in quote.php i am able to take the symbolname from quote_form.php and using lookup function i put the value in $ stock variable , but i do not know how to display it in a new form called quote.php

this is how i am getting the stock value which is working fine

    $stock = lookup($_POST["symbol"]);

    if(false === $stock)
        apologize("symbol enetered is not valid");

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

but i dont know how to access $stock variable in quote.php form , here is the code, at line 8 it is saying undefined variable stock.

<form action="quote.php" method="post"> 


print "A share of" . $stock["name"] . "(" . $stock["symbol"] . ") costs :" . number_format($stock["price"] , 2);

1 Answer 1


i figure it out myself by looking at how apologize sends the message to apology form

and in my case i have to use render like

 render("quote.php", ["stock" => $stock]);

You must log in to answer this question.

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