blueboron Posted October 29, 2006 Share Posted October 29, 2006 Hi,I am a complete newbie with php.I want to design a table in Microsoft Frontpage and place it on my source page - however php requires a \ before quotation marks - Unfortunately the table code has about a zillion quotation marks :'( - is there anyway of solving this problem to save me going mad and updating each \I look forward to any repliesThank youBB Link to comment https://forums.phpfreaks.com/topic/25468-for-quotation-marks/ Share on other sites More sharing options...
Barand Posted October 29, 2006 Share Posted October 29, 2006 The \ is only required in some circumstancesIf you have$str = "<img src="a.gif">";then this would give an error since the " after the = would terminate the string value. So you would need$str = "<img src=\"a.gif\">";to include the " in the value.If you enclosed the whole string in single quotes, you wouldn't need to escape the " with \. So this is OK$str = '<img src="a.gif">';and so is$str = "<img src='a.gif'>";see http://www.php.net/manual/en/language.types.string.php Link to comment https://forums.phpfreaks.com/topic/25468-for-quotation-marks/#findComment-116213 Share on other sites More sharing options...
alpine Posted October 29, 2006 Share Posted October 29, 2006 You can also note the heredoc syntax also found under Barand's link, example:[code]<?phpecho <<<_HTMLHere you can mix both $variables and "quotes" within phpand newlines will be treated as newlines in the source code.<form method="post" action="page.php"><input type="text" name="field" value="$value" /><input type="button" value="whatever" /></form>_HTML;?>[/code] Link to comment https://forums.phpfreaks.com/topic/25468-for-quotation-marks/#findComment-116214 Share on other sites More sharing options...
blueboron Posted October 29, 2006 Author Share Posted October 29, 2006 Thanks very much - I have now put php & html on the same page and it all works well :) Link to comment https://forums.phpfreaks.com/topic/25468-for-quotation-marks/#findComment-116244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.