Results 1 to 3 of 3

Thread: displaying large text from table col but the lines arent breaking

  1. #1
    Join Date
    Jun 2011

    displaying large text from table col but the lines arent breaking

    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..

    <div id="critics">
    		<h2>Critics and Experiences</h2>
    		include_once ('database.inc');       
    		//Add Critic//
    		echo <<< END_FORM
    		<form method="POST">
    				<input required="required" type="text" name="title" /> 
    				<label>Your critic:</label><br>
    				<textarea required="required" cols="50" rows="8" name="critic"></textarea>
    				<input type="submit" name="upload" value="Submit" />
    		if(isset($_POST['title']) && isset($_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>";
    also look at the photo below to see how it looks in my website.. this is what it looks like.. it gets lost..
    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..
    Last edited by telisjok; 12-09-2012 at 01:42 PM.

  2. #2
    Join Date
    Jun 2011
    problem solved... i simply had to use the attribute maxlenght in the textarea... sorry for the pointless long post

  3. #3
    Join Date
    Jun 2011
    You're Welcome

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center