$_GET . Undefined Variable. Cant find solution [cl

2019-03-07 07:23发布

问题:

I'm having an issue and am out of ideas.

I'm trying to get a parameter from the URL, but PHP insists in saying that the variable is not defined.

The URL is

http://localhost/trendwatcher/index.php?date=2014-10-18

And the script is something like

<?php include "header.php"; ?>

        <section id="stats">
            Showing trends for <?php echo $GET_["date"];  ?>
        </section>

And finally, the error:

Showing trends for 
Notice: Undefined variable: GET_ in C:\xampp\htdocs\trendwatcher\index.php on line 4

Does anyone have any ideas?

Thanks!

回答1:

Fix your code from:

<section id="stats">
     Showing trends for <?php echo $GET_["date"];  ?>
</section>

to

<section id="stats">
     Showing trends for <?php echo $_GET["date"];  ?>
</section>