-1

this is my problem:

    echo '<form class="dugme" method="post" name="$b" value="">
<button type="submit">Pusti</button>
</form>';

I have defined $b variable, and want to draw this on page with for loop ($b=0; $b<=10; $b++) .

But in every scenario with " ", ' ' ... i get name="$b" ;

My code:

for ($b=0; $b <= 10; $b++){
echo '<form class="dugme" method="post" name="$b" value="">
<button type="submit">Pusti</button></form>';
}
krazors
  • 134
  • 1
  • 8

1 Answers1

1

you need to concatenate properly

for ($b=0; $b <= 10; $b++){
echo '<form class="dugme" method="post" name="'.$b.'" value="'.$b.'">
<button type="submit">Pusti</button></form>';
}

note : inside the single quotes everything consider as string . you need to escape it or you need to concatenate like this

JYoThI
  • 11,977
  • 1
  • 11
  • 26