Page 1 of 1

retaining variables when refreshing pages?

Posted: Sun Jan 15, 2006 12:27 pm
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

Re: retaining variables when refreshing pages?

Posted: Sun Jan 15, 2006 1:30 pm
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 :)

Posted: Sun Jan 15, 2006 1:51 pm
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?

Posted: Sun Jan 15, 2006 2:06 pm
by shiznatix
cookies are client side... maybe you are thinking of sessions which still wouldnt make sence...

Posted: Sun Jan 15, 2006 2:11 pm
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

Posted: Sun Jan 15, 2006 3:15 pm
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.

Posted: Sun Jan 15, 2006 5:56 pm
by timvw
I would expect a decent production server to write errors and warnings into a file.. Instead of making them public ;)