retaining variables when refreshing pages?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
filfish
Forum Newbie
Posts: 3
Joined: Sat Jan 14, 2006 10:13 pm

retaining variables when refreshing pages?

Post by filfish »

I have a page with a form to input a stock reference number, which will be passed to another page to generate an invoice, the invoice page works fine but i can only send one stock reference number at a time giving me only one entry per invoice.

Is it possible to post the stock reference number from the form to an array on the same page as the form, in order to build an array of stock refence numbers to pass to the invoice page, i have tried but every time I hit the submit button it clears the array

any help would be great
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: retaining variables when refreshing pages?

Post by alex.barylski »

filfish wrote:I have a page with a form to input a stock reference number, which will be passed to another page to generate an invoice, the invoice page works fine but i can only send one stock reference number at a time giving me only one entry per invoice.

Is it possible to post the stock reference number from the form to an array on the same page as the form, in order to build an array of stock refence numbers to pass to the invoice page, i have tried but every time I hit the submit button it clears the array

any help would be great
Read up on cookies or sessions :)
filfish
Forum Newbie
Posts: 3
Joined: Sat Jan 14, 2006 10:13 pm

Post by filfish »

I was trying to avoid cookies, my host isn't supporting them, or if it does it doesn't like ones i've used n the past even though they worked on my home server.

I'm now able to pass a string such as

+oldcode1+oldcode2+newcode

and keep adding to it as i go, sort of putting all the stock references into 1 variable seperated by a '+', how would be the easiest way of estracting 'oldcode1', 'oldcode2' etc to load into individual variables in my invoice page?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

cookies are client side... maybe you are thinking of sessions which still wouldnt make sence...
filfish
Forum Newbie
Posts: 3
Joined: Sat Jan 14, 2006 10:13 pm

Post by filfish »

didn't make sense to me either, they worked perfectly well on my home server, uploaded the entire directory structure then I kept getting errors saying something like 'Fatal error - Session already started by index.html', and not displaying any page
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

filfish wrote:didn't make sense to me either, they worked perfectly well on my home server, uploaded the entire directory structure then I kept getting errors saying something like 'Fatal error - Session already started by index.html', and not displaying any page
Yes... thats because you had error_reporting turned off on your home server and now suddenly the error_reporting is on on the production server :)

If you add:

Code: Select all

error_reporting(E_ALL);
To the top line you the script you'll see what I mean when run on both servers.

Search this forum for "Headers already sent" with all terms selected and you'll see why.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I would expect a decent production server to write errors and warnings into a file.. Instead of making them public ;)
Post Reply