Consider the following code for printing questions from text file:
foreach ($lines as $line_num => $line) {
if($line_num%3 == 1){
echo 'Question '.$count.':'.'<br/>'.'<input type="text" value="$line" class="tcs"/>'.'<br/>';
I’ve tried many string escaping combinations. The problem is that I get $line inside the text field instead of the variable value. Any help is greatly appreciated.
Remove the variable from the
'quoted string, or use"so the variable is interpreted.or
The first option is better, since you don’t have to escape anything else.