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>"; 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. 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? 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> 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. 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. 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 Link to comment https://forums.phpfreaks.com/topic/238377-p-class-errornesting-classes/#findComment-1225055 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.