close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to clear Insert session ID on page reload

Thread began 1/24/2018 6:28 am by Accumike | Last modified 1/31/2018 12:27 pm by Ray Borduin | 143 views | 5 replies |

Accumike

How to clear Insert session ID on page reload

Hi Ray

I have an insert sb that redirects to another page to add some additional info automatically for the user. This uses the session ID variable created by the insert sb as part of the URL string, as follows:

... "&id_act=" . $_SESSION['id_act'] ...

This works correctly.

However, when I go back to the first form page and add another record with the insert sb, the URL string picks up the earlier session ID variable, not the latest.

I tried this unset($GLOBALS['id_act']) code at the start of the insert sb, but it does not seem to work:

if (isset($_POST["WA_Insert1"]) || isset($_POST["WA_Insert1_x"])) {
// Clear any earlier id_act SESSION value
unset($GLOBALS['id_act']);
$InsertQuery = new WA_MySQLi_Query($crm_realpress_wa);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "cu_action_act";
$InsertQuery->bindColumn("idlic_act", "i", "".((isset($_POST["idlic_act"]))?$_POST["idlic_act"]:"") ."", "WA_DEFAULT");
etc...

How should I clear the earlier session ID variable reliably?

Thanks

Michael

Sign in to reply to this post

Ray BorduinWebAssist

unset($_SESSION['id_act']);

Would be the correct code to clear it. However it should be updated with the insert, so I think there is another underlying problem that needs to be fixed. Removing the session variable won't help the problem that the session variable isn't being stored properly.

Sign in to reply to this post

Accumike

Thanks Ray, I'll investigate further.

Sign in to reply to this post

Accumike

Hi Ray

This is what I'm doing – the following is part of a CRM:

I am using the same table (cu_action_act) to store a calendar event, then optional meta information about certain events. I use the same table because my customer wants to track a timeline for each contact on the CRM.

When the crm user inserts the calendar event, the page either returns to display the event (at event.php), or if a particular type of event is inserted the page redirects to another, hidden page (timeline_steps.php), which automatically inserts a further record in cu_action_act, using the session id (id_act) from the first transaction as a key:

$InsertQuery->saveInSession("id_act");

The second transaction does NOT create a session id, as this is not needed:

$InsertQuery->saveInSession("");

On creation of the second record, the timeline_steps.php page redirects back to event.php

Several events may be inserted in succession, following this process.

Would it be advisable to create a session id in the second transaction? Would this then clear the incorrect session id in event.php?

Hope this is clear.

Sign in to reply to this post

Ray BorduinWebAssist

The part I don't understand is why you need to delete the old session variable. I don't understand the problem with your current configuration.

Sign in to reply to this post

Accumike

The session variable 'id_act' is used as part of the URL string when the page redirects. I found that it was picking up the penultimate value for 'id_act', therefore I assumed that the session variable needed to be deleted, so that the latest value for 'id_act' would be used.

I agree that this is unexpected behaviour, so I am going to review my overall process. I suggest that you close this support item, I'll get back to you if I still have a problem.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...