Hello:
I could use some help in formatting my results a bit neater.
My script creates a drop-down where a person can select a customer. Once, a customer is selected, all information pertaining to that customer appears.
Finally, the script gives the person a link to select another customer.
Right now, the information appears like:
Company: whatever
Address: whatever
City: whatever
Home Phone: whatever
I would like to make this more readable by placing the information into a table so the information is all lined up as such:
[code=php]
Company: whatever
Address: whatever
City: whatever
Here is the portion of the script that is displaying the information:
//get rest of customer information
$get_info = “select * from customer where id = $_POST[sel_id]”;
$get_info_res = mysql_query($get_info);
if (mysql_num_rows($get_info_res) > 0) {
$display_block .= ”
<P><b><font size=”2″ face=”Verdana”>Customer Information:</b><br><br>”;
while ($add_info = mysql_fetch_array($get_info_res)) {
$company = $add_info[Company];
$address = $add_info[Address];
$city = $add_info[City];
$state = $add_info[State];
$zipcode = $add_info[zipcode];
$homephone = $add_info[HomePhone];
$workphone = $add_info[WorkPhone];
$email1 = $add_info[PrimaryEmail];
$email2 = $add_info[SecondEmail];
$display_block .= ”
Company: $company<br>
Address: $address<br>
City: $city<br>
State: $state<br>
Zip Code: $zipcode<br>
Home Phone: $homephone<br>
Work Phone: $workphone<br>
Primary Email: $email1<br>
Secondary Email: $email2″;
}
$display_block .= “</font>”;
}
$display_block .= “<br><br><p><font size=”2″ face=”Verdana”><a href=”$_SERVER[PHP_SELF]”>Select Another Customer</a></p></font>”;
}
?>
<html>
<head>
<title>template</title>
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>
I experimented with modifying this section by placing table tags into it as such:
[code=php]
$display_block .= ”
<table border=1>
<tr>
<td>Company:</td> <td> $company</td></tr>
<tr><td>Address:</td> <td> $address/td></tr>
<tr><td>City:</td> <td>$city</td></tr>
<tr><td>State:</td> <td>$state</td></tr>
<tr><td>Zip Code:</td> <td>$zipcode</td></tr>
<tr><td>Home Phone:</td><td>$homephone</td></tr>
<tr><td>Work Phone:</td><td>$workphone</td></tr>
<tr><td>Primary Email:</td><td>$email1</td></tr>
<tr><td>Secondary Email:</td><td>$email2</td></tr>”;
}
$display_block .= “</font>”;
}
$display_block .= “<br><br><p><font size=”2″ face=”Verdana”><a href=”$_SERVER[PHP_SELF]”>Select Another Customer</a></p></font>”;
}
?>
[code=php]
The result places the information after the Select Another Customer Link. I’m not sure why.
If someone can give me some help with formatting, it’ll be greatly appreciated.
Thanks so much.