“Unexpected T_STRING”? [closed]

2020-02-16 04:41发布

echo "Info: <input type=\"text\" name=\"titel\"> value=\" . $row['titel'] . "\">" . "<br />";

Why is it showing:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/lokachan/public_html/andravisaform.php on line 24

标签: php parsing
3条回答
可以哭但决不认输i
2楼-- · 2020-02-16 05:09

Change to:

echo "Info: <input type=\"text\" name=\"titel\"> value=\"" . $row['titel'] . "\">" . "<br />";

You're missing a " after a \".

I would prefer to write it as:

echo 'Info: <input type="text" name="titel"> value="' . $row['titel'] . '"><br />';

Now you don't need so many escapes.

查看更多
做个烂人
3楼-- · 2020-02-16 05:13

This would save you typing

$input = "<input type=\"text\" name=\"%s\" value=\"%s\"><br \/>";

echo sprintf ( $input, "title1",$row ['titel'] );
echo sprintf ( $input, "title2",$row ['tite2'] );
查看更多
孤傲高冷的网名
4楼-- · 2020-02-16 05:29

You're missing a quote

echo "Info: <input type=\"text\" name=\"titel\"> value=\"" . $row['titel'] . "\">" . "<br />";
查看更多
登录 后发表回答