Hi i am new to php. The code below is a page that display results from the database. i included a table. When the search result displays the result it doesnt go on a new line. For example the name neil Mcman and Peter Worth comes in the same line. I want it to go to a new line. for eg

Neil Mcmarn

Peter worth

Any help will be much apreciated

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<form action="welcome.php" method="post">

@mysql_select_db($database) or die( "Unable to select database");

<select name="name" id="name">

$sql="SELECT id,first FROM contacts";
$result =mysql_query($sql);
while ($data=mysql_fetch_assoc($result)){
<option value ="<?php echo $data ?>" ><?php echo $data ?></option>
<?php } ?>

Mobile :
<input name="mobile" type="text" id="mobile">
<input type="submit" value="Submit" name="Submit"/>
<p>&nbsp; </p>

Recommended Answers

All 4 Replies

seems like your new to HTML too...

do you mean they display on the same line after you've submitted the form or what?

yes after i'v submitted the form. And i want it too display in a new line not the same.


you've posted the wrong bit of code, you need to post the bit of code that looks at the form AFTER it's been submitted... welcome.php?

if you want to display a result in a new line
use this "\n" on your php code (if you just want a clear view of your list in loop..or <br /> tags in html...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.