Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.