How would I get this to work?
$step = $_SERVER['PHP_SELF']. '?&step=';
echo "<form action=". $step ."2"><select>";
It's giving me a (Parse error: syntax error, unexpected '<') on the second line. Halp?
How would I get this to work?
$step = $_SERVER['PHP_SELF']. '?&step=';
echo "<form action=". $step ."2"><select>";
It's giving me a (Parse error: syntax error, unexpected '<') on the second line. Halp?
转义字符串内的引号:
echo "<form action=\"${step}2\"><select>";
这将解决您的问题,但在将属性值放入 HTML 之前转义它可能是一个好主意:
echo "<form action=\"" . htmlspecialchars($step) . "2\"><select>";
The " after the 2 ends the string. Escape it or use single quotes.
$step = $_SERVER['PHP_SELF']. '?&step=';
echo "<form action=\"", $step , "2\"><select>";
Try escaping the double-quotes, or using a combination of double/singe:
echo "<form action=\"". $step ."2\"><select>";
or
echo '<form action="'. $step .'2"><select>';
Try actually paying attention to colour coding. Or use an editor that has colour-coding if yours doesn't.
echo '<form action="'.$step.'2"><select>';
$step = $_SERVER['PHP_SELF']. '?&step=';
echo "<form action=". $step .'"2"><select>';
或者
$step = $_SERVER['PHP_SELF']. '?&step=';
echo "<form action=". $step ."\"2\""><select>";