0

I am trying to dynamically change information on a quiz based on what is stored on the database but when I make a reference to the following in my code: echo $selection = $_GET['text'] I get the following error message: Notice: Undefined index: text in /Applications/XAMPP/xamppfiles/htdocs/Quizzer/question.php on line 38

(line 38 is what has been referred to above) Does anyone know why this might be happening? Thanks.

Jay G
  • 1
  • 1
  • It means that there is no such element in your `$_GET` array. Impossible to suggest why not without seeing the code. – droopsnoot Aug 13 '20 at 09:33
  • Well, using or not using _GET does not seem to make a difference at all. I could refer to it without the -GET and leave it as $selection = ['text']; I just get a different error message. What I don't get is why I need to define it if it is coming directly from the database? It is just the data type that was referenced in the db. – Jay G Aug 13 '20 at 09:37
  • `$_GET` is a variable passed in as part of the URL, it has nothing to do with being retrieved from the database. If you drop the `$_GET` you will get a different error, and it still won't work. In what way is it coming "directly from the database"? Can't really help without seeing the code around it. – droopsnoot Aug 13 '20 at 10:48
  • I managed to fix the error I was having above, but I was wondering if you could help with something else? I have a logout system that does not log the user out even though the session has been unset, they remain logged in. Even when the browser closes. It was working fine until I tried it today and I am not sure what has changed. – Jay G Aug 14 '20 at 21:43
  • Post a new question for that, but don't forget to include the code. – droopsnoot Aug 15 '20 at 17:32

0 Answers0