Jump to content


Need Help centering form

  • Please log in to reply
No replies to this topic

#1 ValdouaD

  • Members
  • PipPip
  • Member
  • 22 posts

Posted 08 June 2006 - 03:56 PM

Here is my code taht I have for my results page. I would like to have it come out centered on the page instead of flush left.

// Page two, search and display

$connect = mysql_connect("localhost", "XXXXX", "XXXXX");
$db = mysql_select_db("schylling_storelist", $connect);
$sql = "SELECT *
WHERE State = '".$_POST['state']."'
OR ZIP_Code = '".$_POST['zipCode']."'";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if($rows > 0) {
echo "<table border=\"1\">
<th align=\"center\newstyle\">Name</th>
<th align=\"center\">City</th>
<th align=\"center\">State</th>
<th align=\"center\">Sales Phone</th>";

while($row=mysql_fetch_array($result)) {
echo "<tr>
<td align=\"center\" class=\"newstyle\">".$row['Name']."</td>
<td align=\"center\" class=\"newstyle\">".$row['City']."</td>
<td align=\"center\" class=\"newstyle\">".$row['State']."</td>
<td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td>
else {
echo "No results found";

Also I have the input page code below, I would like to ahve this all lined up nice an center as well and I cant get it to look right:

// Page 1, the form
echo "<div style=\"margin-left: 15pt;\"><form name=\"search\" action=\"spage2.php\" method=\"post\">
Search by Zip: <input type=\"text\" name=\"zipCode\"> (example: 01922)
Search by State: <input type=\"text\" name=\"state\"> <input type=\"submit\"> (example: NY for New York)

Can anyone please help?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users