daddyman Posted March 2, 2018 Share Posted March 2, 2018 In Script 2.6 (page 61) you introduce the syntax for using the "foreach" loop to use array to generate selection options for the pull-down (in this case, the months of the year). In line 24 the opening Option Tag has the value attribute typed as follows: value=\"$key\" Can you please explain the use of the back slashes that appear both before the variable name and also within the quotes following the variable name? I don't believe it is explained previously in the text, but it is used repeatedly throughout the rest of the chapter. Thank you. Link to comment Share on other sites More sharing options...
Larry Posted March 3, 2018 Share Posted March 3, 2018 Sorry for the confusion! The double quotes there are for the HTML (to wrap the value) and if they aren't escaped, they'd create a conflict with the double quotes used for the entire print statement. In other words, those quotes are escaped to literally print a double quote character. Link to comment Share on other sites More sharing options...
daddyman Posted March 12, 2018 Author Share Posted March 12, 2018 Makes sense. I should have recognized that, but was looking at it in the context of what was within the quotes, rather than simply escaping the quotes. Thank you very much. Link to comment Share on other sites More sharing options...
Recommended Posts