开发者

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/a6910668/public_html/event.php on line 83

开发者 https://www.devze.com 2023-02-27 08:26 出处:网络
I\'ve looked at every other question involving this topic, but they are all in different situations, and I\'ve tried to follow some of their tips to no avail. This is my code. The supposed error line

I've looked at every other question involving this topic, but they are all in different situations, and I've tried to follow some of their tips to no avail. This is my code. The supposed error line is in bold.

echo " </select> :
<select name=\"event_time_mm\">
<option value=\"00\">00</option>
<option value=\"15\">15</options>
<option value=\"30\">30</options>
<option value=\"45\">45</options>
</select>
<input type=\"hidden\" name=\"m\" value=\"".$m"\">
**<input type=\"hidden\" name=\"d\" value=\"".$d"\">**
<input type=\"hidden\" name=\"y\" value=\"".$y"\">
<br/><br/>
<input type开发者_StackOverflow中文版=\"submit\" name=\"submit\" value=\"Add Event\">
</form>";


you are missing concatenation . with variables $m, $d ,$y

value=\"".$m."\">

add . after all these three variables.


Just to present another option, the heredoc syntax is quite nice for multi-line strings like this, e.g.:

echo <<<EOD
   <input type="hidden" name="m" value="$m">
   **<input type="hidden" name="d" value="$d">**
   <input type="hidden" name="y" value="$y">
EOD;


Addendum: If you are already using double quotes, you should avoid the concatenation operator and switching in and out of the string altogether:

echo "
   <select>
   <input type=\"hidden\" name=\"m\" value=\"$m\">
   </form>";

Works the same.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号