1

quote.php

<?php
    // configuration
    require("../includes/config.php");
      if ($_SERVER["REQUEST_METHOD"] == "GET")
    {
       //do something

    // else render form
           render("../views/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")
    {
      //Check if symbol attribute is empty
      if(empty($_POST["symbol"]))
        apologize("The symbol cannot be empty");
      else
        {
            $stock = lookup($_POST["symbol"]);
            //Check if symbol is invalid
            if(!$stock)
                {
                  apologize("The symbol is invalid");
                }
            else
                //$quote =["name"=>$stock["name"],"symbol"=>$symbol,"price"=>$stock["price"]];
                render("../views/quote_print.php",["title" => $Quote,"name" =>$stock["name"],"symbol"=>$stock["symbol"],"price"=>$stock["price"]]);
        }
    } 
?>    

quote_form.php

<!--This is a form where the user puts information about his stock -->
<form action = "quote.php" method="post">
  <fieldset>
     <div class="form-group">
            <input autocomplete="off" autofocus class="form-control" name="username" placeholder="Username" type="text"/>
        </div>
        <div class="form-group">
            <input class="form-control" name="symbol" placeholder="Symbol" type="text"/>
        </div>
        <div class="form-group">
            <button class="btn btn-default" type="submit">Submit</button>
        </div>    
  </fieldset>
</form>

quote_print.php

<?php
 echo"A share of".$stock['name']."(".$stock['symbol'].")     costs : $".number_format($stock['price'],2,'.',',');

?>

Error received enter image description here

I have checked the line 313. I have also edited it properly but there is no change. Please help.

3
  • unless we know what are on lines 27 and 313 it's going to be hard to diagnose this – ronga Jul 23 '16 at 5:39
  • It was an invalid error. I have corrected it. – Anirudh Thatipelli Jul 23 '16 at 5:56
  • in that case please mark your question answered to clear it from the stack – ronga Jul 24 '16 at 7:52
0

I have corrected the error myself. It was showing an invalid error but after removing some minor mistakes I had solved the error myself.

You must log in to answer this question.

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