This topic is locked

Resetting a session variable problem

8/23/2006 11:20:33 AM
PHPRunner General questions
A
andyjames author

Hi,
I set a session variable After a Successful login. This works fine.

I want to reset this session variable after editing a certain page just in case the value has been modified since logging in.

So I have used the following code in the "Before Record Updated" event on the Edit page:

...

$_SESSION["var_mothertongue"] = $values["mothertongue"];

...


If I test the value by displaying the value with an echo on another page it has correctly captured the value but has put single quote marks around it? As it is a value in a drop down list that is set as the default, it is not recognised with the quote marks:
e.g.

'French'

instead of

French
Can you advise? Thanks in advance for your assistance! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=3252&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />

J
Jane 8/24/2006

Andy,
to remove single quotes use substr function:

$_SESSION["var_mothertongue"] = substr($values["mothertongue"],1,strlen($values["mothertongue"])-2);



Read m ore info here:

http://www.php.net/manual/en/function.substr.php

A
andyjames author 8/24/2006

Perfecto. Nice one, Jane. Many thanks. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10621&image=1&table=forumreplies' class='bbc_emoticon' alt=':P' />