Re: passing a variable

From: Date: Tue, 06 Mar 2001 23:57:26 +0000
Subject: Re: passing a variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42827@lists.php.net to get a copy of this message
George you are doing this backwards. Someone posted the code to do this the right way last night. I would use the concatination of a third variable.
        $field = "blah";
        $loops = 10;
for ($i=0; $i < $loops; $i++) {
        $displayField = $field . $i;
        echo "<tr><td><input type=text name=\"$field\"
        value=\"$displayField\">\n";
} Rick At 11:31 PM 3/6/01 +0000, george wrote:
I am trying to build a dynamic form, and I am using the code below to let the user ,name the fields that are generated,but i want to give the user the option of changing individual field sizes but I cant get it to work. TIA george for ($i=0; $i < $fields; $i++) { $fieldName = "field$i";
    echo "<tr><td><input type=text name=\"$fieldName\"
    value=\"${$fieldName}\">\n";
}
    echo "<input type=hidden name=\"fields\"
    value=\"$fields\">\n</td></tr>";
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
########################################################## # Rick St Jean, # rstjean@internet.look.ca # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ##########################################################

« previous php.general (#42827) next »