Re: serialize
| From: | Erik Price | Date: | Tue, 05 Mar 2002 16:07:49 +0000 |
| Subject: | Re: serialize | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87281@lists.php.net to get a copy of this message | ||
On Tuesday, March 5, 2002, at 09:58 AM, Axel Nilsson wrote:
I use this code to create a number of fields in a form depending on what input number I use. My problem occurs when i am going to save it. Right now only the value of the last field gets stored. I want to serialize all values from all fields so that they can be saved as a stringvalue is there any friendly soul out there who knows how to do it? /Axel <?php for ($i=0; $i<$HTTP_GET_VARS['num']; $i++) { echo "felnummer <INPUT TYPE=\" TEXT\" name=\"felnummer[i]\"><BR>"; } ?>I did the exact same code just last week. Try this: for ($i = 0; $i < $_GET['num']; $i++) { echo "felnummer <input type=\"text\" name=\"" . fellnummer["$i"] . "\" /><br />"; } It is very important that you use the doublequotes in the 'fellnummer["$i"]' and not use single quotes, or your variable will not expand to the value of $i (it will think that you want a literal 'buck i'). Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com