Porkie Posted June 28, 2009 Share Posted June 28, 2009 print ("<table>"); print ("<tr>"); print ("<td>"); echo 'smooth' print ("</td>"); print ("</tr>"); print ("<tr>"); print ("<td>"); echo 'lala' print ("</td>"); print ("<td align="left" valign="top">"); echo '<h2>Description</h2>'; echo stripslashes($video['description']); print ("</td>"); print ("</tr>"); print ("</table>"); my problem is i want description to be shown at the top of the box so i tried using valign however dont understand why i get an error? Parse error: syntax error, unexpected T_STRING in /home/public_html/Newdirectory/video.php on line 70 , line 70 being the valign line cheers in advance Quote Link to comment https://forums.phpfreaks.com/topic/163982-php-table-help/ Share on other sites More sharing options...
Ken2k7 Posted June 28, 2009 Share Posted June 28, 2009 The double quotes around your HTML attributes are messing up the ones you're using for print. print "<td align='left' valign='top'>"; See the difference? One more thing worth noting, print is a language construct and not a PHP function so the parentheses are not needed. Quote Link to comment https://forums.phpfreaks.com/topic/163982-php-table-help/#findComment-865072 Share on other sites More sharing options...
wildteen88 Posted June 28, 2009 Share Posted June 28, 2009 You need to escape any double quotes within your string, like so print ("<td align=\"left\" valign=\"top\">"); If you don't escape your quotes PHP will end your string prematurely and thus you'll get the error you're retrieving. Or start your string with single quotes print ('<td align="left" valign="top">'); Also there's no need to echo each line separately. echo/print can span multiple lines, like so echo '<table> <tr> <td>smooth</td> </tr> <tr> <td>lala</td> <td align="left" valign="top"> <h2>Description</h2>'. stripslashes($video['description']).' </td> </tr> </table>'; Quote Link to comment https://forums.phpfreaks.com/topic/163982-php-table-help/#findComment-865075 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.