i have a table in which users post their critics about holiday locations, like an island or a mountain..
the table contains 3 columns, the id, the title and the critic.
i am then displaying the table in my website with the code below. so my problem is that when someone types a large critic in the textarea (max is 500 chars) the lines will not break when displaying the talbe and the texts will be lost at the end of the page...
anysolutions and help will be highly appreciated..
also look at the photo below to see how it looks in my website.. this is what it looks like.. it gets lost..Code:<div id="critics"> <h2>Critics and Experiences</h2> <?php include_once ('database.inc'); db_open(); //Add Critic// { echo <<< END_FORM <form method="POST"> <p> <label>Name:</label><br> <input required="required" type="text" name="title" /> </p> <p> <label>Your critic:</label><br> <textarea required="required" cols="50" rows="8" name="critic"></textarea> </p> <p> <input type="submit" name="upload" value="Submit" /> </p> </form> END_FORM; } if(isset($_POST['title']) && isset($_POST['critic'])) { $title=mysql_real_escape_string($_POST['title']); $critic=mysql_real_escape_string($_POST['critic']); $sql="INSERT into falakro_table VALUES (NULL, '$title', '$critic')"; @ $result = mysql_query($sql); if ($result) { echo "Posted!";} else { echo "Posting failed..";} } //Display Database as HTML table// $result=mysql_query("SELECT title,critic FROM falakro_table"); if (!$result) { die ("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "<table> <span>Name<span> <span style='margin-left:120px;'>Critics and experiences</span>"; //printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } echo "</table>"; mysql_free_result($result); db_close(); ?> </div>
Attachment 15273
as you see, the third row has the largest comment for the critic col, and the line is not breaking.. even if the text is written seperated with spaces (spacebar) the text will again disappear
i know my english is not good and im sorry for that..


Reply With Quote
Bookmarks