Bentley4 Posted June 4, 2011 Share Posted June 4, 2011 Hi guys, When I use this statement it gives the syntax error, unexpected T_STRING, expecting ',' or ';' : echo "<p class="SuperqAndQAndA">" ; Any idea why? Also, can I nest different p classes? Eg: echo "<p class="QandA"><p class="Answers">".$row['TAnswer']."</p></p>"; Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/ Share on other sites More sharing options...
wildteen88 Posted June 4, 2011 Share Posted June 4, 2011 You need to escape the double quotes within your string echo "<p class=\"SuperqAndQAndA\">" ; Also, can I nest different p classes? Yes, but having nest P tags is invalid HTML. Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225037 Share on other sites More sharing options...
Bentley4 Posted June 4, 2011 Author Share Posted June 4, 2011 You need to escape the double quotes within your string echo "<p class=\"SuperqAndQAndA\">" ; Thanks, works! Yes, but having nest P tags is invalid HTML. What do you reccomend me to do in this situation? Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225043 Share on other sites More sharing options...
wildteen88 Posted June 4, 2011 Share Posted June 4, 2011 Why do you need nested paragraph tags? If you're using P tags to layout the content in your site then you should look into using divs <div id="mainContent"> <p>Paragraph 1</p> <p>Paragraph 2</p> </div> Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225046 Share on other sites More sharing options...
Bentley4 Posted June 4, 2011 Author Share Posted June 4, 2011 It was for the folowwing structure: I. Mainquestion 1.Question1 Answer1 2.Question2 Answer2 .... I needed seperate layout control for the Mainq, question and answers. The problem is that they are echoed by conditional statements. Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225053 Share on other sites More sharing options...
wildteen88 Posted June 4, 2011 Share Posted June 4, 2011 If you need help with your HTML then post a question within the HTML Board. This forum is for getting help with your PHP code not HTML layout issues. Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225054 Share on other sites More sharing options...
Bentley4 Posted June 4, 2011 Author Share Posted June 4, 2011 Ok, thnx Quote Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225055 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.