Jump to content

[SOLVED] Do I need a SESSION here?


kingnutter

Recommended Posts

Hi everyone,

 

In the CMS I am creating, tracks.php is updateable via edit_track.php

 

Only when a user has updated an entry I want a notification to be echoed at the top of tracks.php saying RECORD UPDATED.

 

I am attempting to use a SESSION thus to no avail.

 

In edit_track.php:

<?php

session_start();
$_SESSION['updated'] = 'yes'; ?>

<html>...

 

and in tracks.php:

...if (isset ($_SESSION['updated']))
{
echo 'RECORD UPDATED';
unset($_SESSION['updated']);
}

 

Should I perhaps be using POST or GET instead?

 

Thanks,

 

KN

Link to comment
https://forums.phpfreaks.com/topic/159928-solved-do-i-need-a-session-here/
Share on other sites

You only need to use sessions if you need the value to persist through all pages of the site until it is destroyed. If it is just to remember an id for a database update on a single page then it would be much easier using a hidden field containing the value in a form. If you are using it to display a message then a url parameter would be easier i.e.

tracks.php?update=true

Thanks for the suggestion, Neil.

 

I'm already sending a variable 'id' as a url parameter. Is it possible to have more than one in a URL?

 

Also, this modification is intended to include to UPDATE, DELETE and ADDED, so is there a sort of "three way switch" I can use to pass the info to the next page?

 

Cheers.

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.