javascript - How do i print multiple values separately in php? -


i'm retrieving data database using unique id. problem is, values being retrieved , being printed in single line. want them below 1 another. tried "
" "\n
" , nl2br. if me. in advance.

php file:

<?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'db'; $db = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if(mysqli_connect_errno())  { die("connection couldn't established"); } if(isset($_post['enrno']) === true && empty($_post['enrno']) === false) { //$enr = $_post['enrno']; $enrno = mysql_real_escape_string ($_post['enrno']); $query = "select * cert enrno = '$enrno'";     $result = $db->query($query);     $total_num_rows = $result->num_rows;     while ($row=$result->fetch_array())   {   echo ("enrno: " .$row["enrno"]);   echo ("name: " .$row["name"]);   echo ("batch code: " .$row["batch code"]);    echo ("start date: " .$row["start date"]);   echo ("end date: ".$row["end date"]);   echo ("course: " .$row["course"]);   echo ("duration: " .$row["duration"]);  }  mysqli_free_result($result);     } else {         echo ('data not found');     }; ?> 

html file:

<!doctype html> <html> <head> </head> <body> enr no: <input type="text" name="enrno" id="enrno" /><br/><br /> <input type="submit" name="retrieve" value="retrieve" id="enrno-sub" /> <div id="enrno-data"></div> <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> <script type="text/javascript">  $('input#enrno-sub').on('click', function() {  var enrno = $('input#enrno').val(); if (enrno != '') { $.post('retrieve.php', {enrno: enrno}, function(data) {      $('div#enrno-data').text(data);  });  }   }); </script> </body> </html> 

try "
", instead of "\n", example:

 echo "value1  :".$value1."<br>";  echo "value2  :".$value2."<br>";  echo "value3  :".$value3."<br>";  echo "value4  :".$value4."<br>";  echo "value5  :".$value5."<br>"; 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -