Jump to content

Sessions


FIREBALL5

Recommended Posts

I'm trying to make a mechanism that saves information through repeated refreshes, but it's not adding on relatively; it's overwriting. Even using sessions. Here is some code:

 

session_start(); 
$_SESSION["id"] = $_GET['q']; 
$_SESSION["answerQ"] = $_POST['answer'];
$_SESSION["myanswer"][$_SESSION["id"]-1] = $_SESSION["answerQ"]; 

 

This code is called every time the page refreshes. However, $_SESSION["myanswer"][$_SESSION["id"] -1] keeps getting reset. $_SESSION["id"] is getting incremented by 1 every refresh.

 

.. Thanks ..?

 

-FIREBALL5

 

Link to comment
https://forums.phpfreaks.com/topic/111036-sessions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.