4

The request method is GET by default. When the user visits http://pset7/sell.php, she is requesting the page (i.e., sell.php in this case) using GET. Therefore, the condition $_SERVER["REQUEST_METHOD] == "POST" is initially false and the else branch is executed as a result. To fix this, you need to render the template if the requesting method is not POST (...


2

It looks like you aren't actually putting anything into the HTML to display the value itself. Can you try something like this? echo "<option value = \"".$row["Symbol"]."\">".$row["Symbol"]. "</option>";


1

Just after I posted a question i got it. I should put all data manipulations under else from request.method == "POST".


1

This is sketchy: foreach($result as $result): ?> because the var names are the same (and I'm not sure about : in php). Wouldn't the proper syntax here <option value="$result["name"]"> be <option value="<?= $result['name'] ?>">? Syntax of the echo is not what you want in the second version since it will literally echo "<option> $name &...


1

How are you passing the php variable from your controller to your viewing page (sell page)? You are storing the array returned by your mysql query in $symbol, but it looks like you are passing $stocks variable to your sell page. Also, how did you set up your table in mysql? If you did it as given in pset specs, then I'm guessing you want to access the stock ...


Only top voted, non community-wiki answers of a minimum length are eligible