Page 1 of 1

html to php

Posted: Fri Jun 27, 2008 3:56 am
by IshGan
Hi All

I am new to PHP so please tolerate my question....

I am using HTML form to POST values to PHP page using PHP_SELF ....

Everytime the user enters a new value and submits to PHP I would like to retain all the old values submitted by the user.

I tried to use array and pass array as hidden value from HTML but it didn't help..

will using $_SESSION help this issue or is there a better way to do it....

I would appreciate any help on this.

Thankks
Ish ..

Re: html to php

Posted: Fri Jun 27, 2008 4:05 am
by WebbieDave
With regards to the functionality you're after, sessions can be used for short-term value storage. Otherwise, a database would serve immensely better when longer term and/or larger storage is required.

Re: html to php

Posted: Fri Jun 27, 2008 4:21 am
by IshGan
Hi Webbie

Thanks for your reply..

I am looking to store for short term .... ie .,. everytime the user enters a new value and submits I would like to show all the values entered by that user.

If I had to use session variable could you please give me an example of storing array in session.

Thanks
Ish ..

Re: html to php

Posted: Fri Jun 27, 2008 4:33 am
by WebbieDave
Sure:

Code: Select all

session_start();
$arr = array('a', 'b', 'c');
$_SESSION['arr'] = $arr;