andalib14 Posted May 1, 2010 Share Posted May 1, 2010 i have a code where the elements of a dvd shud be viewd not in a line but with new lines when the user views the elements... <?php include('session.php'); include('session_check.php'); ?> <?php include('database.php'); if(isset($_SESSION['user_name'])) { $session=$_SESSION['user_name']; $sql1="select * from user_table where user_name like '%$session%' "; $result1=mysql_query($sql1); $row1=mysql_fetch_array($result1); $id=$row1['id']; $sql="select * from dvd_info where user_id like '%$id%' "; $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { echo "Dvd Name : ".$row['dvd_name']; echo"</br>"; $array=array(); $array=split(",",$row['contents']); $size=count($array); echo "Contents:"; for($i=0;$i<$size;$i++) { echo $array[$i]; } //echo " Contents :".$row['contents']; echo "<br /><br />"; } } ?> <form action="home.php" method="post"> <center> <input type="submit" value="Home" > </center> here the contents come up in a line...how can i seperate each content by new line/? by the way i hav asked the users to enter the contents when they save them separateing by ENTER. Quote Link to comment https://forums.phpfreaks.com/topic/200346-how-to-make-new-lines/ Share on other sites More sharing options...
ChemicalBliss Posted May 1, 2010 Share Posted May 1, 2010 use nl2br(); on the user submitt info, any 'enter' breaklines will be converted to HTML <BR> breakline tags. -cb- Quote Link to comment https://forums.phpfreaks.com/topic/200346-how-to-make-new-lines/#findComment-1051408 Share on other sites More sharing options...
andalib14 Posted May 1, 2010 Author Share Posted May 1, 2010 tnx bro it seems to work but the contents now comes up in a messd way...like this Dvd Name : ANdalibs dvd Contents:hey i seem to like u i want it to come up like: Dvd Name : ANdalibs dvd Contents:hey i seem to like u how can i do that? and can i sumhow make it and unorderd list?? Quote Link to comment https://forums.phpfreaks.com/topic/200346-how-to-make-new-lines/#findComment-1051410 Share on other sites More sharing options...
Ken2k7 Posted May 1, 2010 Share Posted May 1, 2010 That's a display issue, not a programming issue. You can have a DIV aligned like that so the contents display the way you want it. Quote Link to comment https://forums.phpfreaks.com/topic/200346-how-to-make-new-lines/#findComment-1051435 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.