Bentley4 Posted May 12, 2011 Share Posted May 12, 2011 In the following code the sign "\" is used before "/index.php?....". What does this sign mean in a link statement? Does it mean it automatically adds the url of the webfolder or phpfile? <?php echo "<a href=\"/index.php?sid=".$name."&question=".$nextquest."\">next</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/236216-sign-immediatly-after/ Share on other sites More sharing options...
Zane Posted May 12, 2011 Share Posted May 12, 2011 that backslash is used to escape the double quotes... because you can't have double quotes inside of double quotes. Unless you escape your double quote with a \ slash, then the parse will think you are ending the string once it sees the second double quote. Quote Link to comment https://forums.phpfreaks.com/topic/236216-sign-immediatly-after/#findComment-1214500 Share on other sites More sharing options...
gristoi Posted May 12, 2011 Share Posted May 12, 2011 It is escaping the string for you. because you are using double quotes within double qoutes then without them your echo would output: <a href= onely, and the rest would be ignored / thrown error Quote Link to comment https://forums.phpfreaks.com/topic/236216-sign-immediatly-after/#findComment-1214501 Share on other sites More sharing options...
Maq Posted May 12, 2011 Share Posted May 12, 2011 IMO, it's easier to use single quotes for the attributes if your primary string is double quoted. Either of these should work: echo "next"; ?> echo "next"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/236216-sign-immediatly-after/#findComment-1214511 Share on other sites More sharing options...
Bentley4 Posted May 13, 2011 Author Share Posted May 13, 2011 Thnx guys! Quote Link to comment https://forums.phpfreaks.com/topic/236216-sign-immediatly-after/#findComment-1215048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.