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
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to