I am new new to PHP and would like some help. I have read as much as i could but could not get any help hence why i donot even have code i had tried.

Assume a database names "sales" with fields" fieldOne" and "fieldtwo". using sql and PHP how can i get the data in the database to be displayed on a form.

I basically want a use to enter a phone number that is unique to each record then have the rest of the data called up from the database and returned to a form i have designed in HTML. i have been able to recall the data but is not displayed where i want it to be.
thnx

post the code for your html form

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="en-za" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<style type="text/css">
.auto-style1 {
	text-align: center;
}
.auto-style3 {
	text-align: center;
	font-size: xx-large;
}
.auto-style4 {
	text-align: left;
}
.auto-style5 {
	text-align: left;
	margin-left: 40px;
}
.auto-style6 {
	margin-left: 40px;
}
</style>



<?PHP
//make connection to the database
$connect = mysql_connect("localhost", "root","");
if (!$connect)
    {
       die("database connection failed". mysql_error());
    }
//make sure we’re using the right database
$select_db = mysql_select_db("lero_med");
if (!select_db)
   {
     die("database selection failed " .mysql_error());
   }

//post the number
	$Number = trim($_POST['Number']);

//query to search for the specified number
$query = "SELECT Number,Name,Address FROM customers WHERE Number = '$Number' ORDER BY Name";
$results = mysql_query($query)
or die("Something went wrong");
/*
   this is where i get stuck, i can recall the other data from my database but i cant        place it as i would like. i donot even know if what i want is possible.
*/
while ($row = mysql_fetch_array($results))
 {
	extract($row);
	echo $Number;
	echo " - ";
	echo $Name;
	echo " - ";
	echo $Address;
	echo "<br>";
 }


?>

</head>

<body>
<p class="auto-style1">
<img alt="Lero Mad-Chem" src="../img6.jpg" height="213" width="262" /></p>
<hr />
<p class="auto-style3">Clerk Main Sales Page</p>
<hr />
<p class="auto-style1"><a href="check_stock.htm">Check Stock</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="check_sales.php">Check_Sales</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="Drawings.php">Drawings</a></p>
<p class="auto-style1">&nbsp;</p>
&nbsp;
<form method="post" action="main.php">
	<fieldset name="Customer_details">
		<legend style="width: 145px">Customer Details</legend>
	<br />
<p class="auto-style4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;





Customer's Phone Number:&nbsp;&nbsp;&nbsp;&nbsp;
		<input name="Number" type="text" value="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          
		<input name="SearchNumber" type="submit" value="Search" /></p>
		
		
		
		
		
	<p class="auto-style4">&nbsp;</p>
	<p class="auto-style5">Customer's Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>
		<input name=" Name" type="text" /></p>
		

	<p class="auto-style5">Customer's Address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<textarea cols="20" name="Address" rows="1" style="width: 195px; height: 64px"></textarea>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


		<input name="Button4" type="submit" value="Commit" />&nbsp;&nbsp; </p>
	<p class="auto-style6">&nbsp;</p>
	</fieldset></form>
</body>

</html>

Not sure what the extract is for, it is as simple as

while ($row = mysql_fetch_array($results))
 {
	echo $row['Number'].' - '. $row['Name'].' - '. $row['Address'].'<br>';
 }

You also need to clean up your HTML (i.e. get rid of all those $nbsp;)

i see simply beat me too it

also if you want to put it into a table and style it

<?PHP
echo "<table id='table'><tr><td>NUMBER</td><td>NAME</td><td>ADDRESS</td></tr>";
    while ($row = mysql_fetch_array($results))
    {
 echo "<tr><td>".$row['Number']."</td><td>".$row['Name']."</td><td>".$row['Address']."</td></tr>";
    }
echo "</table>";
?>

we have input boxes to send data from the form to wherever, is there a reverse for that? how do i tell the browser specifically where to place the result from the query?

change this

<?PHP
    echo "<table id='table'><tr><td>NUMBER</td><td>NAME</td><td>ADDRESS</td></tr>";
    while ($row = mysql_fetch_array($results))
    {
    echo "<tr><td>".$row['Number']."</td><td>".$row['Name']."</td><td>".$row['Address']."</td></tr>";
    }
    echo "</table>";
    ?>

to this

<?PHP
    while ($row = mysql_fetch_array($results))
    {
$number[] = $row['Number'];
$name[] = $row['Name'];
$address[] = $row['Address'];
    ?>

then any where out side of it you can loop any of those arrays to display the code

// put this somewhere after to display the results
$counted = count($number)
for ( $counter = 0 ; $counter <= $counted; $counter += 1) {

echo $number[$counter]." ".$name[$counter]." ".$address[$counter];

}

thank you. on a completely unrelated question..
is it possible to send more that one query to the same database from the same form at
the same time?
assume i have one query that simply reads data form the database and prints it. can i also have one that changes that value on one table, the tables are in the same database but no relation.

mysql does not allow multi querys at once but you could do this

// i assume your already connected to the database
$query1 = "query 1";
$query2 = "query 1";

// Perform Query
$result1 = mysql_query($query1);
$result2 = mysql_query($query2);

// if you want data back from one of the querys
while ($row = mysql_fetch_assoc($result1)) {
   $fname[] =  $row['firstname'];
     $lname[] = $row['lastname'];
   $address[] = $row['address'];

}

i think this should solve my problem, please look at my thread titled "decrementing".
i am trying to read from my database. i would like to read from one table, then with the same submit button change a value in another table. if you spot the reason it does not work please tell me what was wrong so i can understand it better

this might solve my other problem. i have one database with two tables, i use one connecting statement. i then want to read from one table then change a value in the other database. this i want to do in the same form hence same submit button. please look at the thread i have posted titled "decrement".
p.s, please do not just give me the correct codding but also tell me why the one i had could not work.

not a problem do you still want help with the other post i looked at it is it giving you a error or not the desired result ?

also i would do all the adding outside of the query

do you still need help with the other one ?

yes please assist me where u can