I am trying to increase/decrease the value of $_SESSION['count'] by 1
after clicking on a link e.g index.php?gotoWk=nxtWk and index.php?
gotoWk=lstWk. I'm sure you will get the drift if you look at the code
below.
However, this code seems to be unreliable. Is there a more robust way
of achieving the same thing?
Many thanks,
Chris
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} elseif($_REQUEST['gotoWk'] == "nxtWk") {
$_SESSION['count']++;
} elseif($_REQUEST['gotoWk'] == "lstWk") {
$_SESSION['count']--;
} 7 2517
On Nov 2, 7:19 pm, Chris <matchett...@googlemail.comwrote:
I am trying to increase/decrease the value of $_SESSION['count'] by 1
after clicking on a link e.g index.php?gotoWk=nxtWk and index.php?
gotoWk=lstWk. I'm sure you will get the drift if you look at the code
below.
However, this code seems to be unreliable. Is there a more robust way
of achieving the same thing?
What do you mean by "seems to be unreliable?"
Chris wrote:
I am trying to increase/decrease the value of $_SESSION['count'] by 1
after clicking on a link e.g index.php?gotoWk=nxtWk and index.php?
gotoWk=lstWk. I'm sure you will get the drift if you look at the code
below.
However, this code seems to be unreliable. Is there a more robust way
of achieving the same thing?
Many thanks,
Chris
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} elseif($_REQUEST['gotoWk'] == "nxtWk") {
$_SESSION['count']++;
} elseif($_REQUEST['gotoWk'] == "lstWk") {
$_SESSION['count']--;
}
I don't see what why you think it's unreliable. Looks like it should do
exactly what you're explaining you want done. The only thing i'd
personally change is the $_REQUEST. I would use $_GET instead.
On 3 Nov, 06:12, Chris Gorospe <ch...@ekast.comwrote:
Chris wrote:
I am trying to increase/decrease the value of $_SESSION['count'] by 1
after clicking on a link e.g index.php?gotoWk=nxtWk and index.php?
gotoWk=lstWk. I'm sure you will get the drift if you look at the code
below.
However, this code seems to be unreliable. Is there a more robust way
of achieving the same thing?
Many thanks,
Chris
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} elseif($_REQUEST['gotoWk'] == "nxtWk") {
$_SESSION['count']++;
} elseif($_REQUEST['gotoWk'] == "lstWk") {
$_SESSION['count']--;
}
I don't see what why you think it's unreliable. Looks like it should do
exactly what you're explaining you want done. The only thing i'd
personally change is the $_REQUEST. I would use $_GET instead.- Hide quoted text -
- Show quoted text -
It is not reliable in that when a link is clicked it doesn't always
add or take away 1 appropiately?
Cheers,
Chris
On 3 Nov, 06:12, Chris Gorospe <ch...@ekast.comwrote:
Chris wrote:
I am trying to increase/decrease the value of $_SESSION['count'] by 1
after clicking on a link e.g index.php?gotoWk=nxtWk and index.php?
gotoWk=lstWk. I'm sure you will get the drift if you look at the code
below.
However, this code seems to be unreliable. Is there a more robust way
of achieving the same thing?
Many thanks,
Chris
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} elseif($_REQUEST['gotoWk'] == "nxtWk") {
$_SESSION['count']++;
} elseif($_REQUEST['gotoWk'] == "lstWk") {
$_SESSION['count']--;
}
I don't see what why you think it's unreliable. Looks like it should do
exactly what you're explaining you want done. The only thing i'd
personally change is the $_REQUEST. I would use $_GET instead.- Hide quoted text -
- Show quoted text -
Just to clarify why I need help.
If I use the code above when I click my add '>>' link first time all
is ok. The next take away click '<<' adds 1 then starts taking away 1
with further clicks. Returning to '>>' takes away 1 and then continues
to add 1?
Very confused?!
Cheers,
Chris
Chris wrote:
On 3 Nov, 06:12, Chris Gorospe <ch...@ekast.comwrote:
>Chris wrote:
>>I am trying to increase/decrease the value of $_SESSION['count'] by 1 after clicking on a link e.g index.php?gotoWk=nxtWk and index.php? gotoWk=lstWk. I'm sure you will get the drift if you look at the code below. However, this code seems to be unreliable. Is there a more robust way of achieving the same thing? Many thanks, Chris if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } elseif($_REQUEST['gotoWk'] == "nxtWk") { $_SESSION['count']++; } elseif($_REQUEST['gotoWk'] == "lstWk") { $_SESSION['count']--; }
I don't see what why you think it's unreliable. Looks like it should do exactly what you're explaining you want done. The only thing i'd personally change is the $_REQUEST. I would use $_GET instead.- Hide quoted text -
- Show quoted text -
Just to clarify why I need help.
If I use the code above when I click my add '>>' link first time all
is ok. The next take away click '<<' adds 1 then starts taking away 1
with further clicks. Returning to '>>' takes away 1 and then continues
to add 1?
Very confused?!
Cheers,
Chris
Then you aren't telling us the entire story, Chris. This code won't
work that way.
Let's see ALL the code you're using.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
On 3 Nov, 13:44, Jerry Stuckle <jstuck...@attglobal.netwrote:
Chris wrote:
On 3 Nov, 06:12, Chris Gorospe <ch...@ekast.comwrote:
Chris wrote: I am trying to increase/decrease the value of $_SESSION['count'] by 1 after clicking on a link e.g index.php?gotoWk=nxtWk and index.php? gotoWk=lstWk. I'm sure you will get the drift if you look at the code below. However, this code seems to be unreliable. Is there a more robust way of achieving the same thing? Many thanks, Chris if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } elseif($_REQUEST['gotoWk'] == "nxtWk") { $_SESSION['count']++; } elseif($_REQUEST['gotoWk'] == "lstWk") { $_SESSION['count']--; }
I don't see what why you think it's unreliable. Looks like it should do
exactly what you're explaining you want done. The only thing i'd
personally change is the $_REQUEST. I would use $_GET instead.- Hide quoted text -
- Show quoted text -
Just to clarify why I need help.
If I use the code above when I click my add '>>' link first time all
is ok. The next take away click '<<' adds 1 then starts taking away 1
with further clicks. Returning to '>>' takes away 1 and then continues
to add 1?
Very confused?!
Cheers,
Chris
Then you aren't telling us the entire story, Chris. This code won't
work that way.
Let's see ALL the code you're using.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -
- Show quoted text -
Jerry,
All code attached.
Cheers,
Chris
// Count for weekno
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}
if($_GET['nxtWk'] == '1') {
$_SESSION['count']++;
}
if($_GET['lstWk'] == '1') {
$_SESSION['count']--;
}
$_SESSION['weeknumber'] = date('W')+$_SESSION['count'];
--html--
<p><a href="index.php?lstWk=1"><<</aBack Next <a
href="index.php?nxtWk=1">>></a>
<?=$_SESSION['weeknumber']; ?>
</p>
Chris wrote:
On 3 Nov, 13:44, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Chris wrote:
>>On 3 Nov, 06:12, Chris Gorospe <ch...@ekast.comwrote: Chris wrote: I am trying to increase/decrease the value of $_SESSION['count'] by 1 after clicking on a link e.g index.php?gotoWk=nxtWk and index.php? gotoWk=lstWk. I'm sure you will get the drift if you look at the code below. However, this code seems to be unreliable. Is there a more robust way of achieving the same thing? Many thanks, Chris if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } elseif($_REQUEST['gotoWk'] == "nxtWk") { $_SESSION['count']++; } elseif($_REQUEST['gotoWk'] == "lstWk") { $_SESSION['count']--; } I don't see what why you think it's unreliable. Looks like it should do exactly what you're explaining you want done. The only thing i'd personally change is the $_REQUEST. I would use $_GET instead.- Hide quoted text - - Show quoted text - Just to clarify why I need help. If I use the code above when I click my add '>>' link first time all is ok. The next take away click '<<' adds 1 then starts taking away 1 with further clicks. Returning to '>>' takes away 1 and then continues to add 1? Very confused?! Cheers, Chris
Then you aren't telling us the entire story, Chris. This code won't work that way.
Let's see ALL the code you're using.
-- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck...@attglobal.net ==================- Hide quoted text -
- Show quoted text -
Jerry,
All code attached.
Cheers,
Chris
// Count for weekno
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}
if($_GET['nxtWk'] == '1') {
$_SESSION['count']++;
}
if($_GET['lstWk'] == '1') {
$_SESSION['count']--;
}
$_SESSION['weeknumber'] = date('W')+$_SESSION['count'];
--html--
<p><a href="index.php?lstWk=1"><<</aBack Next <a
href="index.php?nxtWk=1">>></a>
<?=$_SESSION['weeknumber']; ?>
</p>
Why are you adding or subtracting the count from the current week number?
And why are you even storing the count in $_SESSION? You don't use it
from one page to the next.
Also, I don't see a call to session_start().
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
================== This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alexandre MELARD |
last post by:
Hi,
My name is alexandre, I am 4th year student at the Napier university
of edinburgh.
I am finishing my year and do a presentation of my honours project
next wednesday (the 5th of May).
I am...
|
by: stu_gots |
last post by:
I have been losing sleep over this puzzle, and I'm convinced my train
of thought is heading in the wrong direction. It is difficult to
explain my circumstances, so I will present an identical...
|
by: john |
last post by:
Hi,All MS Tech Gurus:
I need your help!!! It is the second time I post this message, I need get
some feedback ASAP, Please Help!!
Thanks a lot in advance.
John
I have a csharp method, using...
|
by: Marc Bishop |
last post by:
I'm trying to get this to work but i'm at a loss as to how.
i've searched google without much help
code
Dim ArrCart As new ArrayList()
ArrCart = CType(Session("sesCart"), ArrayList)...
|
by: steroche |
last post by:
I would REALLY appreciate help please please please! Im sure it is
probably blindingly obvious to most of you but I am totally in the dark
here!I am lost - i thought i had finally figured out this...
|
by: Bruno Alexandre |
last post by:
Hi guys,
I'm using a session to save an ArrayList, so I do not read Database
everytime user reload the page or enter the site (the Data is consistent for
all entire session time when the user is...
|
by: TRB_NV |
last post by:
I'd been using an Access database based shopping cart, but wanted to change
it so that it would use session variables. I have a form that's submitted
to a page called addtocart.asp that contains...
|
by: Mike Collins |
last post by:
I someone can please help, I am about at an end in trying to figure this out.
I am adding some dynamic controls to my page (I found out that I was supposed
to be doing that in the oninit event,...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: StevenChiasson |
last post by:
For the record, not a student, just someone attempting to learn C++. Anyway, the problem I'm having right now is the member function detAddress, of object controller.
This is more or less, your...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |