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.
精彩评论