Re: simple I'm sure

From: Date: Wed, 14 Mar 2001 15:29:17 +0000
Subject: Re: simple I'm sure
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43853@lists.php.net to get a copy of this message
It's bizarre it should work but I get back just 1, 2 or 3 Although with this just to test <input type=\"hidden\" name=\"test\" value=\"$art_nr_1\"> it works fine and i get back <input type="hidden" name="test" value="124478"> And really weird it this version for ($i=1; $i<50; $i++) : $quantid = "quant".$i ; if ($$quantid != "") {
    $artid = "art_nr_".$i;
    echo "
    <input type=\"hidden\" name=\"artnr_$i\" value=\"$$artid\">
    <input type=\"hidden\" name=\"quant_$i\" value=\"$$quantid\">
    <input type=\"hidden\" name=\"test\" value=\"$art_nr_1\">
    ";
} endfor; which gives me back
    <input type="hidden" name="artnr_1" value="$art_nr_1">
    <input type="hidden" name="quant_1" value="$quant1">
I can't spot the problem at all ? At 10:19 14/03/01 -0500, Jack Dempsey wrote:
try this...didn't test it, but i think it'll do the trick: for($i=1;$i<50;$i++){
        $varid = "quant".$i;
        if($$varid != ""){
                echo '<input type=hidden name="art_nr" value="';
                echo $art_nr_ . $i;
                echo '">';
                echo '<input type=hidden name="quantity" value="';
                echo $quant . $i;
                echo '">';
        }
} jack Keith wrote: Following loop works fine ! but I don't want $art_nr_1 (which is 4564) I want to have $art_nr_$i but if you use it you just get 1,2,3,4 for ($i=1; $i<50; $i++) : $varid = "quant".$i ; if ($$varid != "") { echo " <input type=hidden name=\"art_nr\" value=\"$art_nr_1\"> <input type=hidden name=\"quantity\" value=\"$quant1\"> "; } endfor; -- 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 -- 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


« previous php.general (#43853) next »