0

I'm getting this error when I go into my Quote page on the website:

Fatal error: Invalid view: quote_form.php in /home/ubuntu/workspace/pset7/includes/helpers.php on line 155

Here's my quote_form.php (there are <> brackets where necessary, but when I type it here, it becomes invisible):

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

<fieldset>
    <div class="form-group">
        <input name = "symbol" placeholder = "symbol" type = "text"/>
    </div>
    <div class= "form-group">
        <input type="submit">
    </div>
</fieldset>

/form

And this is my quote:

?php

require("../includes/config.php");

if ($_SERVER["REQUEST_METHOD"] == "GET")

{
    render("quote_form.php", ["title" => "Quote"]);
}

if ($_SERVER["REQUEST_METHOD"] == "POST")

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

    if ($stock == false)
    {
        apologize("Stock isn't valid.");
    }
    else
    {
        render("quote2.php", [$price = number_format($stock["price"], 2, '.', '')]);
    }

}

?>

Thanks for any help!

2
  • error message refers to /home/ubuntu/workspace/pset7/includes/helpers.php on line 155, maybe you inadvertently changed helpers.php?
    – ronga
    Jul 21, 2016 at 13:50
  • Line 155 is this: trigger_error("Invalid view: {$view}", E_USER_ERROR); I think it means they're showing the error from helpers.php, not that there's an error in helpers.php, but I can't tell what's wrong...
    – little
    Jul 22, 2016 at 4:04

1 Answer 1

1

You can see from helpers.php the conditions under which that particular error will be triggered:

if (file_exists("../views/{$view}"))
        {
            // extract variables into local scope, tc.


        // else err
        else
        {
            trigger_error("Invalid view: {$view}", E_USER_ERROR);
        }
    }

You must log in to answer this question.

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