Webmaster Forum

Webmaster Forum (http://www.v7n.com/forums/index.php)
-   Coding Forum (http://www.v7n.com/forums/forumdisplay.php?f=16)
-   -   input hidden (http://www.v7n.com/forums/showthread.php?t=358067)

klwm 12-19-2013 01:15 AM

input hidden
 
PHP Code:

<?php
foreach ($travel as $t)
  {
    echo 
"<input type=\"hidden\" name=\"travel[]\" value=\"$t\" />\n";
  }
?>

Could you please explain what is the role of symbol "\" in this code?
Does the code give the same result without that symbol?

raicabogdan 12-20-2013 03:12 PM

Because your echo quotes are double quotes, in order to use the same double quotes with the input html attributes you have to escape the quotes, else it will be interpreted that the echo contents have ended. To escape the quotes you use the backslash " \ " in front of what you want to escape.


All times are GMT -7. The time now is 02:40 PM.

3.8.7