Jump to content

Archived

This topic is now archived and is closed to further replies.

ValdouaD

Need Help centering form

Recommended Posts

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 *
FROM STOREDATA
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>
</tr>";
}
}
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)
<br>
Search by State: <input type=\"text\" name=\"state\"> <input type=\"submit\"> (example: NY for New York)
<br>
</form></div>";
?>


Can anyone please help?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.