Reputation: 3168
I have the following example usage:
$insert = "
INSERT INTO table (
field
) VALUES (
'".$_SESSION['field']."'
)
";
For some reason it's inserting blanks and no data is being submitted. Is what I am doing the right way?
I do have multiple fields but they were too many so just shrunk the example to include only one field.
Upvotes: 0
Views: 85
Reputation: 2055
Use session_start() for starting the session before assigning anything to $_SESSION['field'].
After insertion you can delete session variables but not the session itself using session_unset(), or you can destroy the variables using session_destroy().
Upvotes: 1