shebbycs Posted April 9, 2013 Share Posted April 9, 2013 In the picture below show the result taking from taskreportview.php If u can see on the Operation field when I insert the long data, the data move forward My main question is how to make the data jump to below for example aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa to aaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa //TaskReportview.php <?php mysql_connect("localhost","root") or die ("could not connect to the mysql"); mysql_select_db("kime") or die ("no database"); $a=$_SESSION['branchcodename']; $b=$_SESSION['ID']; $sql2 = mysql_query("SELECT *,DATE_FORMAT(Task_Date, '%d/%m/%Y %l:%i %p') AS Task_Date FROM task_report WHERE ID='$b' ORDER BY Task_Date") or die(mysql_error()); echo "<body bgcolor='#F5D16A'>"; echo "<center><img src ='OK.gif'></center><br>"; echo "<center><h2>OPERATION REPORT</h2>"; echo "<table><tr><td><h3>LOCATION</h3></td><td><h3>:</h3></td><td><h3>".$a."</h3></td></tr></table></center>"; echo "<center><table border = '1'>"; echo "<tr><th>DATE & TIME</th><th>STAFF NAME</th><th>TASK</th><th>OPERATION</th><th>ACTION & RESULTS</th></tr>"; while($report = mysql_fetch_array($sql2)) { echo "<tr align='center'><td>".$report['Task_Date']."</td>"; echo "<td>".$report['Task_Name']."</td>"; echo "<td>".$report['Task_Task']."</td>"; echo "<td>".$report['Task_Operation']."</td> "; echo "<td>".$report['Task_Action']."</td> "; } echo"</table><h2><a href='taskreportform.php'>Add Task Form</a><br></h2><h2><a href='logout.php'>Logout</a></h2></center>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/ Share on other sites More sharing options...
Q695 Posted April 9, 2013 Share Posted April 9, 2013 Table width="x" should solve it if there's a space in there. Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1423643 Share on other sites More sharing options...
shebbycs Posted April 9, 2013 Author Share Posted April 9, 2013 Table width="x" should solve it if there's a space in there. not working for me Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1423646 Share on other sites More sharing options...
Q695 Posted April 10, 2013 Share Posted April 10, 2013 Then table width should be 100% Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1423836 Share on other sites More sharing options...
shebbycs Posted April 10, 2013 Author Share Posted April 10, 2013 Then table width should be 100% same also not working for me Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1423842 Share on other sites More sharing options...
shebbycs Posted April 10, 2013 Author Share Posted April 10, 2013 while($report = mysql_fetch_array($searchall)) { echo "<tr align='center'><td>".$report['Task_Date']."</td>"; echo "<td>".$report['Branch_Codename']."</td>"; echo "<td>".$report['Task_Name']."</td>"; echo "<td>".$report['Task_Task']."</td>"; echo "<td>".str_replace("\r","<br>",$report['Task_Operation'])."</td>"; echo "<td>".nl2br($report['Task_Action'])."</td>"; echo "<td>".$report['Check_By']."</td></tr>"; } This works perfect when using textarea in task operation and task action but the main problem was when we input data in textarea and we enter to line break then only it will convert using that str replace or nl2br but what I want when user input data in textarea, it will automatically line break without user 'Enter' input Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1423843 Share on other sites More sharing options...
InoBB Posted April 30, 2013 Share Posted April 30, 2013 (edited) Have you tried placing the input text within a DIV set to whatever width you set? This would force text that is longer than the specified DIV width to break back to the begining of the div on a new line. echo "<td>" . str_replace("\r", "<br><div style='width: " . $div_width . "';>", $report['Task_Operation']) . "</div></td>"; replace $div_width with whatever you think it should be, or just set a variable so you can maybe make it adjustable via admin or w/e. Edited April 30, 2013 by InoBB Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1427387 Share on other sites More sharing options...
Psycho Posted May 1, 2013 Share Posted May 1, 2013 Do you really have values in your database that are 50+ characters without any spaces? This is a "problem" I see reported all the time - especially when someone is testing max length restrictions on fields. This is an edge case scenario that doesn't need to be fixed in my opinion. Unless you expect that those types of values are going to be valid it's not worth the time and effort to add logic to handle it. But, to answer your question directly. I don't believe there is any way, with just HTML and CSS, to make a line of characters with no spaces or other "break" characters (dash, period, tab, etc.) break across lines. You would have to do that in server-side code. Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1427392 Share on other sites More sharing options...
theverychap Posted May 21, 2013 Share Posted May 21, 2013 CSS3 allows us to use word-wrap:break-word; Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1431380 Share on other sites More sharing options...
Q695 Posted May 22, 2013 Share Posted May 22, 2013 Do you really have values in your database that are 50+ characters without any spaces? It's called a chat room, and a user trying to mess up the layout. Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1431614 Share on other sites More sharing options...
Psycho Posted May 22, 2013 Share Posted May 22, 2013 It's called a chat room, and a user trying to mess up the layout. Really? Your supposed example was an "Operation Report" which one would naturally assume is for business purposes. If someone in a company is purposefully submitting data to corrupt the layout I would consider that a personnel issue. Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1431628 Share on other sites More sharing options...
Q695 Posted May 23, 2013 Share Posted May 23, 2013 I'm needing to do the same thing for a chat room. Quote Link to comment https://forums.phpfreaks.com/topic/276705-how-to-make-td-data-spacing-below-if-the-browser-need-to-scroll/#findComment-1431731 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.