473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

php session failure

In a php session I have set up a user can input several hundred values
on a form.

I then show the user what he or she has entered on a preview page
which he or she can then click ok or cancel.

On clicking cancel the user should be backed using this code

<td>
<div align="center">
<input type="Submit" value = "Continue">
&nbsp;
<input type="button" value="Cancel" onClick="history.back()">
</div>
</td>

I have used this before at it worked. However it now returns the user
to the previous page (form entry), but now all the values are empty.
Annoying if the user just made one simple mistake in the several
hundred entries they wanted to correct.

Any ideas what I am doing wrong?

Any other tricks to acheive this?

Garry Jones
Sweden

Aug 21 '07 #1
6 1868
On Aug 21, 3:48 pm, GarryJones <mor...@algonet.sewrote:
In a php session I have set up a user can input several hundred values
on a form.

I then show the user what he or she has entered on a preview page
which he or she can then click ok or cancel.

On clicking cancel the user should be backed using this code

<td>
<div align="center">
<input type="Submit" value = "Continue">
&nbsp;
<input type="button" value="Cancel" onClick="history.back()">
</div>
</td>

I have used this before at it worked. However it now returns the user
to the previous page (form entry), but now all the values are empty.
Annoying if the user just made one simple mistake in the several
hundred entries they wanted to correct.

Any ideas what I am doing wrong?

Any other tricks to acheive this?

Garry Jones
Sweden
Do you have session_start() on top of both pages?
Post a snippit of offending HTML code of the form entry page, for now,
please.

Aug 21 '07 #2
GarryJones wrote:
In a php session I have set up a user can input several hundred values
on a form.

I then show the user what he or she has entered on a preview page
which he or she can then click ok or cancel.

On clicking cancel the user should be backed using this code

<td>
<div align="center">
<input type="Submit" value = "Continue">
&nbsp;
<input type="button" value="Cancel" onClick="history.back()">
</div>
</td>

I have used this before at it worked. However it now returns the user
to the previous page (form entry), but now all the values are empty.
Annoying if the user just made one simple mistake in the several
hundred entries they wanted to correct.

Any ideas what I am doing wrong?

Any other tricks to acheive this?

Garry Jones
Sweden
As you've found, history.back() is not foolproof. And what if they have
javascript disabled?

It's harder, but put the cancel button in a form. In that form have the
values as hidden fields, i.e.
<form action="/entrypage.php" method="post">
<input type=hidden name="value1" value="<?php echo $value1;%>
<input type=hidden name="value2" value="<?php echo $value2;%>
<input type=hidden name="value3" value="<?php echo $value3;%>
<input type=submit value="Cancel">
</form>

Then on entrypage.php use:

<?php
$value1 = isset($_POST['value1']) ? $_POST['value1'] : "";
$value2 = isset($_POST['value2']) ? $_POST['value2'] : "";
$value3 = isset($_POST['value3']) ? $_POST['value3'] : "";
%>
....

<input type=text name="value1" value="<?php echo $value1;%>">
<input type=text name="value2" value="<?php echo $value2;%>">
<input type=text name="value3" value="<?php echo $value3;%>">

Of course, loops and arrays can make the coding simpler.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 21 '07 #3
As you've found, history.back() is not foolproof. And what if they have javascript disabled?
It's harder, but put the cancel button in a form. In that form have the values as hidden fields, i.e.
The strange thing is I have identical code that works for users
elsewhere on the site. In "user entry" the number of entries allowed
is 10 sets of 10. This is where users enter themselves and club
members into events.

This particular code is for the race organisers to enter the details
of particpiants who register "on the line" by filling in a form. The
race office then needs to be able to enter all this data. Some race
organisers need to key in several thousand entrants. I chose 30 at a
time as a balance between "ease of use" and "risk of lost data during
entry". (Not nice to have keyed in 3000 lines of code and see the
computer screen go blank when the tea lady trips over the cable just
as you where about to press enter).

Anyway, I have much more control about java being on and so on as it
is a limited number of people actually keying in this data. This entry
form is also hidden behind an admin login folder on the website and
this not open to the masses.

So its strange that history.back() works on the initial code but not
on this. My coding is identical except for the inclusion of more rows
and the fact that its behind a htaccess/htpasswd page.

However I have already stored the values as hidden on the preview page
so I simply need to use the "value=" on the form entry page to fix it.
So problem solved, but its still strange how identical code works/
doesn't work on the same website from my own pc.

Thanks for your help
Garry Jones
Sweden

Aug 22 '07 #4
I solved it.

I simply removed the session_start() from the top of the user entry
form.

I dont use any session variables until the preview page when the
values are read in. Neither was I using the session_start() on the
other entry form I referred to above.

Ah, mayybe thats what ELINTPimp meant....? ie "do you have....?"
because its wrong to do so....???

Garry Jones
Sweden

Aug 22 '07 #5
GarryJones wrote:
>As you've found, history.back() is not foolproof. And what if they have javascript disabled?
It's harder, but put the cancel button in a form. In that form have the values as hidden fields, i.e.

The strange thing is I have identical code that works for users
elsewhere on the site. In "user entry" the number of entries allowed
is 10 sets of 10. This is where users enter themselves and club
members into events.
It can be a lot of things. For one thing, you're depending on the
browser cache to fill in the fields.
This particular code is for the race organisers to enter the details
of particpiants who register "on the line" by filling in a form. The
race office then needs to be able to enter all this data. Some race
organisers need to key in several thousand entrants. I chose 30 at a
time as a balance between "ease of use" and "risk of lost data during
entry". (Not nice to have keyed in 3000 lines of code and see the
computer screen go blank when the tea lady trips over the cable just
as you where about to press enter).
A reasonable compromise.
Anyway, I have much more control about java being on and so on as it
is a limited number of people actually keying in this data. This entry
form is also hidden behind an admin login folder on the website and
this not open to the masses.
You're not using java. You're using javascript. The only thing they
have in common are two 'a's, a 'j' and a 'v'.
So its strange that history.back() works on the initial code but not
on this. My coding is identical except for the inclusion of more rows
and the fact that its behind a htaccess/htpasswd page.
And can also be dependent on the amount of data being entered.
However I have already stored the values as hidden on the preview page
so I simply need to use the "value=" on the form entry page to fix it.
So problem solved, but its still strange how identical code works/
doesn't work on the same website from my own pc.
That's the only sure-fire way. Your way depends on certain behavior by
the browser (javascript enabled, cache enabled and large enough) which
can be changed by the user.

Thanks for your help
Garry Jones
Sweden

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 22 '07 #6
GarryJones wrote:
I solved it.

I simply removed the session_start() from the top of the user entry
form.

I dont use any session variables until the preview page when the
values are read in. Neither was I using the session_start() on the
other entry form I referred to above.

Ah, mayybe thats what ELINTPimp meant....? ie "do you have....?"
because its wrong to do so....???

Garry Jones
Sweden
No, your first message was "session failure" - which is why he asked the
question. But your question has to do with javascript and history - and
has nothing to do with session failure.

See my other note - you're depending a lot on the browser which may or
may be configured to do what you want.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 22 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
1
by: gfuller | last post by:
- We have 2 aspx pages in a .NET project. The first sets a session variable and has a button that when clicked performs a 'redirect' to the second page which then reads the session variable. ...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
5
by: Mike | last post by:
I have the need to keep a substantial amount of session state, but I do not have the option of using the HttpSessionState object. My current scheme for dealing with this is to convert all the...
5
by: Andrew Robinson | last post by:
I have a web application that sets a session variable and then executes a Response.Redirect("otherpage.aspx"). My code / application seems to work just fine under Windows Xp on my dev box but...
13
by: Eric Layman | last post by:
Hi everyone, Will clustering of webservers affect SESSION states? Is there a dotnet term for the above mentioned scenario? Pls advise. Thanks.
13
by: Samir Chouaieb | last post by:
Hello, I am trying to find a solution to a login mechanism for different domains on different servers with PHP5. I have one main domain with the user data and several other domains that need...
12
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
7
by: Microsoft Newsserver | last post by:
Hi Folks. I have an issue I need some help with if thats OK. I am running Framework 2.0 using Windows Integrated Security. For most of the application we manage session timeouts without the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.