Jump to content

help in this line ....


june_c21

Recommended Posts

hi,

i getting error when i try to execute this code

 

for (i=1 ; i<11 ; i++) 
  { 
  	echo "<tr>";
    echo"<td><p><strong>[i]</strong></p></td> ";
    echo"<td><textarea name='causes[i]' cols='30' id='causes' value='$causes[i]'></textarea></td>";
    echo"<td><textarea name='corrective_action[i]' cols='50' id='corrective_action' value='$corrective_action[i]'></textarea></td>";
    echo"<td><input name='name[i]' type='text' id='name' value='$name[i]' /></td>";
    echo "<td><input name='date[i]' type='text' id='date' value='$date[i]' /></td>";
    echo "<td><textarea name='remarks[i]' cols='50' id='remarks' value='$remarks[i]'></textarea></td>";
echo"</tr>";

}

 

anyone can tell me what's wrong ??

 

thanks a lot

Link to comment
https://forums.phpfreaks.com/topic/195248-help-in-this-line/
Share on other sites

You didn't use $ before the variable names... and I recommend using brackets when directly using variables within double quotes:

for ($i=1; $i<11; $i++)
  {
     echo "<tr>";
    echo"<td><p><strong>[{$i}]</strong></p></td> ";
    echo"<td><textarea name='causes[{$i}]' cols='30' id='causes' value='{$causes[$i]}'></textarea></td>";
    echo"<td><textarea name='corrective_action[{$i}]' cols='50' id='corrective_action' value='{$corrective_action[$i]}'></textarea></td>";
    echo"<td><input name='name[{$i}]' type='text' id='name' value='{$name[$i]}' /></td>";
    echo "<td><input name='date[{$i}]' type='text' id='date' value='{$date[$i]}' /></td>";
    echo "<td><textarea name='remarks[{$i}]' cols='50' id='remarks' value='{$remarks[$i]}'></textarea></td>";
   echo"</tr>";
   
   }

 

I guess you already solved this though? o.O

Link to comment
https://forums.phpfreaks.com/topic/195248-help-in-this-line/#findComment-1026164
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.