Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Positioning date & time on page

Status
Not open for further replies.

peterv6

Programmer
Sep 10, 2005
70
US
I have a web page (see code below) where I want to display the date & time below the submit button, after skipping one blank line. No matter what I've tried, the date & time keep coming out in the lower right next to the submit button. (You can view the page at ). I'm new to PHP & HTML, so please be kind. If anyone (or everyone :)) can point out what I'm doing incorrectly (along with any other tips you might like to pass along), I'd greatly appreciate it!
Peter V.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- ADD_USER.HTML - Updated: Monday, September 01, 2008 - 7:23 PM -->
<head>
<title>Add User</title>
</head>
<body>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="adduserf.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="4"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADD USER</strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="password" size="8" maxlength="8" id="mypassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
<td bgcolor="CYAN">
<?php
//Adjust time forward by one hour (CST to EST)
$dtm_adjustment = 60 * 60;
$adj_now = time() + $dtm_adjustment;
$today = date("l F dS, Y h:i A", $adj_now);
echo "$today EDT";
// echo "Vanderhaden Consulting - $today EDT";
?>

</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>

PETERV
Syracuse, NY &
Boston, MA
 
This is not a php question, but a basic html question from what I can gather.

You have two choices

1. Put the date on a new row in the html table:

Code:
<tr>
<td></td>
<td></td>
  <td>
  <?php
  //Adjust time forward by one hour (CST to EST)
      $dtm_adjustment = 60 * 60;
      $adj_now = time() + $dtm_adjustment;
      $today = date("l F dS, Y h:i A", $adj_now);
      echo "$today EDT";
  //    echo "Vanderhaden Consulting - $today EDT";
  ?>
</td>
</tr>

2. Put a <br /> tag after the submit button:
Code:
<td>
  <input type="submit" name="Submit" value="Login">
  <br />
  <?php
  //Adjust time forward by one hour (CST to EST)
      $dtm_adjustment = 60 * 60;
      $adj_now = time() + $dtm_adjustment;
      $today = date("l F dS, Y h:i A", $adj_now);
      echo "$today EDT";
  //    echo "Vanderhaden Consulting - $today EDT";
  ?>
</td>

Bottom line, you have the date stuff in it's own cell on the same row as the submit button so it is doing exactly what you are asking it to do.
 
you have put it in the next table cell, not the next row.
 
tweenerz,
If you check the webpage now It looks like some kind of column spanning problem. Any ideas how to fix it? I want it to be on one line beneath the login button.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- ADD_USER.HTML - Updated: Tuesday, September 02, 2008 7:44:40 PM  -->
<head>
<title>Add User</title>
</head>
<body>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="adduserf.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="4"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADD USER</strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="password" size="8" maxlength="8" id="mypassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
<tr>
<?php
//Adjust time forward by one hour (CST to EST)
//   $dtm_adjustment = 60 * 60;
//   $adj_now = time() + $dtm_adjustment;
//   $today = date("l F dS, Y h:i A", $adj_now);
//   echo "$today EDT";
// echo "Vanderhaden Consulting - $today EDT";
?>
<td></td>
<td></td>
  <td>
  <?php
  //Adjust time forward by one hour (CST to EST)
      $dtm_adjustment = 60 * 60;
      $adj_now = time() + $dtm_adjustment;
      $today = date("l F dS, Y h:i A", $adj_now);
      echo "$today EDT";
  //    echo "Vanderhaden Consulting - $today EDT";
  ?>
</td>
</tr>
</table>
</td>
</table>
</form>
</body>
</html>

PETERV
Syracuse, NY &
Boston, MA
 
this is not a php question and would be better placed in the HTML forum

your code above does not mirror the source in the link that you posted. in that link you have not got the two td cells padding the content to the right, you instead have a single cell spanning 4 columns. which is odd, since your table only has three columns.

I note above that you have blank cells with no content within. it is best to add a non-breaking space as you have done elsewhere in the code.
 
I'd remove the width="300", make it larger, or use a percentage (width="20%").

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top