Solved

How do I center horizontally nested DIV buttons

Posted on 2009-04-08
13
1,836 Views
Last Modified: 2013-11-19
I have a nested DIV to created a cool looking button but I can't get it to centre properly in my table.  This is problematic in both IE and FF.  

Any advise is appreciated!
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Discount-o-Matic :: Query</title>

<style type="text/css">
 

html, body

{

	height: 100%;         /* required */	

}
 

body

{

	text-align: center;   /* horizontal centering hack for IE */

	padding: 0;           /* required to "hide" distance div */

	margin: 0;            /* required to "hide" distance div */

	font-family:Arial, Helvetica, sans-serif;     /* optional font */

	font-size:12px;       /* optional size */

	color: #000000;       /* optional colour */
 

}
 

div#horizon

{

	margin-bottom: -10em; /* half of content height */

	background: red;      /* temporary - used to see div */

	width: 1px;           /* required to "hide" distance div */

	height: 50%;          /* required */

	float: left;          /* required */

}
 

div#content

{

	position: relative;   /* positions content on top of distance */

	text-align: left;     /* horizontal centering hack for IE */

	height: 20em;         /* required - desired height */

	width: 40em;          /* required - desired width */

	background: #f9fbfd;        /* cosmetic */

	border: 1px solid #d7e5f2;  /* cosmetic */

	border-collapse: collapse;  /* cosmetic */

	padding: 5px;					 /* cosmetic */

	margin: 0 auto;       /* required */

	clear: left;          /* required */

	

}
 

form

{

   text-align:center;

}
 

input.tiny

{

	border: 1px solid #99b3b4;

	width: 50px;

	background: #e4ebeb;

	font: 11px verdana, sans-serif;

	color:#009900;

	padding:3px;

	margin-bottom:4px;

	outline:none;

}
 

input.tiny:focus 

{

	border:1px solid #567475;

	background: #e4ebeb;

}
 

/* BUTTONS */
 

.buttons a, .buttons button

{

    display:block;

    float:left;

    margin:0 7px 0 0; 

    background-color:#f5f5f5;

    border:1px solid #dedede;

    border-top:1px solid #eee;

    border-left:1px solid #eee;
 

    font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;

    font-size:100%;

    line-height:130%;

    text-decoration:none;

    font-weight:bold;

    color:#565656;

    cursor:pointer;

    padding:5px 10px 6px 7px; /* Links */

}
 

.buttons button

{

    width:auto;

    overflow:visible;

    padding:4px 10px 3px 7px; /* IE6 */

}
 

.buttons button[type]

{

    padding:5px 10px 5px 7px; /* Firefox */

    line-height:17px; /* Safari */

}
 

*:first-child+html button[type]

{

    padding:4px 10px 3px 7px; /* IE7 */

}
 

.buttons button img, .buttons a img

{

    margin:0 3px -3px 0 !important;

    padding:0;

    border:none;

    width:16px;

    height:16px;

}
 

/* STANDARD */
 

button:hover, .buttons a:hover{

    background-color:#dff4ff;

    border:1px solid #c2e1ef;

    color:#336699;

}

.buttons a:active{

    background-color:#6299c5;

    border:1px solid #6299c5;

    color:#fff;

}
 

/* POSITIVE */
 

button.positive, .buttons a.positive

{

    color:#529214;

}
 

.buttons a.positive:hover, button.positive:hover

{

    background-color:#E6EFC2;

    border:1px solid #C6D880;

    color:#529214;

}
 

.buttons a.positive:active

{

    background-color:#529214;

    border:1px solid #529214;

    color:#fff;

}
 

/* NEGATIVE */
 

.buttons a.negative, button.negative

{

    color:#d12f19;

}
 

.buttons a.negative:hover, button.negative:hover

{

    background:#fbe3e4;

    border:1px solid #fbc2c4;

    color:#d12f19;

}
 

.buttons a.negative:active

{

    background-color:#d12f19;

    border:1px solid #d12f19;

    color:#fff;

}
 

</style>

</head>
 

<body>

<?php include_once("db.php"); ?>

	

<div id="horizon"></div>

<div id="content">

   <!-- absolutely centred content -->

  

   <?php

    if ( isset( $_POST['authCode'] ) )

	 {

	    $authLookup = strtoupper($_POST['authCode']);

       $database = "discount-o-matic";

		 $query    = "SELECT customer, location, discount, competition, reason, authCode, camera, name FROM discount 

INNER JOIN cameras ON discount.cid = cameras.cid

INNER JOIN salesmen ON discount.uid = salesmen.uid

WHERE authCode = '$authLookup'";

          @mysql_connect($sql['host'], $sql['user'], $sql['pass']);

          mysql_select_db($database);

          $result = mysql_query($query);

          while ( $row = mysql_fetch_object( $result ) )

          { 

			    // replace with a table

				 // and centre results; 

             echo "Customer: " . "<strong>$row->customer</strong><br />";

				 echo "Location: " . "<strong>$row->location</strong><br />";

				 echo "Discount: " . "<strong>$row->discount</strong><br />";

				 echo "Competition: " . "<strong>$row->competition</strong><br />";

				 echo "Reason: " . "<strong>$row->reason</strong><br />";

				 echo "Authorization Code: " . "<strong>$row->authCode</strong><br />";

				 echo "Camera: " . "<strong>$row->camera</strong><br />";

				 echo "Salesman: " . "<strong>$row->name</strong><br />";				 

          }

             mysql_free_result($result);

	 }

	 else

	 {

	 // this needs to be centred too, the button and shiznit

?>   

   <form id="frmQuery" name="frmQuery" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">

      <p>Please Key in the Authorization Code to Query the Database </p>

      <p>

         <input name="authCode" type="text" class="tiny" id="authCode" />

      </p>

		<div class="buttons">

         <button type="submit" class="positive"><img src="/images/icons/database_go.png" alt=""/> 

        		Query the Database</button>

      </div>

      </p>

   </form>

 <?php } ?>

</div>

</body>

</html>

Open in new window

0
Comment
Question by:jwnrb
  • 6
  • 6
13 Comments
 
LVL 14

Expert Comment

by:EMB01
ID: 24099555
Try putting a container class around your buttons div as attached.
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Discount-o-Matic :: Query</title>

<style type="text/css">

 

html, body

{

	height: 100%;         /* required */	

}

 

body

{

	text-align: center;   /* horizontal centering hack for IE */

	padding: 0;           /* required to "hide" distance div */

	margin: 0;            /* required to "hide" distance div */

	font-family:Arial, Helvetica, sans-serif;     /* optional font */

	font-size:12px;       /* optional size */

	color: #000000;       /* optional colour */

 

}

 

div#horizon

{

	margin-bottom: -10em; /* half of content height */

	background: red;      /* temporary - used to see div */

	width: 1px;           /* required to "hide" distance div */

	height: 50%;          /* required */

	float: left;          /* required */

}

 

div#content

{

	position: relative;   /* positions content on top of distance */

	text-align: left;     /* horizontal centering hack for IE */

	height: 20em;         /* required - desired height */

	width: 40em;          /* required - desired width */

	background: #f9fbfd;        /* cosmetic */

	border: 1px solid #d7e5f2;  /* cosmetic */

	border-collapse: collapse;  /* cosmetic */

	padding: 5px;					 /* cosmetic */

	margin: 0 auto;       /* required */

	clear: left;          /* required */

	

}

 

form

{

   text-align:center;

}

 

input.tiny

{

	border: 1px solid #99b3b4;

	width: 50px;

	background: #e4ebeb;

	font: 11px verdana, sans-serif;

	color:#009900;

	padding:3px;

	margin-bottom:4px;

	outline:none;

}

 

input.tiny:focus 

{

	border:1px solid #567475;

	background: #e4ebeb;

}

 

div#container {
 

  text-align: center ;

  margin-left: auto ;

  margin-right: auto ;
 

}

/* BUTTONS */

 

.buttons a, .buttons button

{

    display:block;

    float:left;

    margin:0 7px 0 0; 

    background-color:#f5f5f5;

    border:1px solid #dedede;

    border-top:1px solid #eee;

    border-left:1px solid #eee;

 

    font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;

    font-size:100%;

    line-height:130%;

    text-decoration:none;

    font-weight:bold;

    color:#565656;

    cursor:pointer;

    padding:5px 10px 6px 7px; /* Links */

}

 

.buttons button

{

    width:auto;

    overflow:visible;

    padding:4px 10px 3px 7px; /* IE6 */

}

 

.buttons button[type]

{

    padding:5px 10px 5px 7px; /* Firefox */

    line-height:17px; /* Safari */

}

 

*:first-child+html button[type]

{

    padding:4px 10px 3px 7px; /* IE7 */

}

 

.buttons button img, .buttons a img

{

    margin:0 3px -3px 0 !important;

    padding:0;

    border:none;

    width:16px;

    height:16px;

}

 

/* STANDARD */

 

button:hover, .buttons a:hover{

    background-color:#dff4ff;

    border:1px solid #c2e1ef;

    color:#336699;

}

.buttons a:active{

    background-color:#6299c5;

    border:1px solid #6299c5;

    color:#fff;

}

 

/* POSITIVE */

 

button.positive, .buttons a.positive

{

    color:#529214;

}

 

.buttons a.positive:hover, button.positive:hover

{

    background-color:#E6EFC2;

    border:1px solid #C6D880;

    color:#529214;

}

 

.buttons a.positive:active

{

    background-color:#529214;

    border:1px solid #529214;

    color:#fff;

}

 

/* NEGATIVE */

 

.buttons a.negative, button.negative

{

    color:#d12f19;

}

 

.buttons a.negative:hover, button.negative:hover

{

    background:#fbe3e4;

    border:1px solid #fbc2c4;

    color:#d12f19;

}

 

.buttons a.negative:active

{

    background-color:#d12f19;

    border:1px solid #d12f19;

    color:#fff;

}

 

</style>

</head>

 

<body>

<?php include_once("db.php"); ?>

	

<div id="horizon"></div>

<div id="content">

   <!-- absolutely centred content -->

  

   <?php

    if ( isset( $_POST['authCode'] ) )

	 {

	    $authLookup = strtoupper($_POST['authCode']);

       $database = "discount-o-matic";

		 $query    = "SELECT customer, location, discount, competition, reason, authCode, camera, name FROM discount 

INNER JOIN cameras ON discount.cid = cameras.cid

INNER JOIN salesmen ON discount.uid = salesmen.uid

WHERE authCode = '$authLookup'";

          @mysql_connect($sql['host'], $sql['user'], $sql['pass']);

          mysql_select_db($database);

          $result = mysql_query($query);

          while ( $row = mysql_fetch_object( $result ) )

          { 

			    // replace with a table

				 // and centre results; 

             echo "Customer: " . "<strong>$row->customer</strong><br />";

				 echo "Location: " . "<strong>$row->location</strong><br />";

				 echo "Discount: " . "<strong>$row->discount</strong><br />";

				 echo "Competition: " . "<strong>$row->competition</strong><br />";

				 echo "Reason: " . "<strong>$row->reason</strong><br />";

				 echo "Authorization Code: " . "<strong>$row->authCode</strong><br />";

				 echo "Camera: " . "<strong>$row->camera</strong><br />";

				 echo "Salesman: " . "<strong>$row->name</strong><br />";				 

          }

             mysql_free_result($result);

	 }

	 else

	 {

	 // this needs to be centred too, the button and shiznit

?>   

   <form id="frmQuery" name="frmQuery" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">

      <p>Please Key in the Authorization Code to Query the Database </p>

      <p>

         <input name="authCode" type="text" class="tiny" id="authCode" />

      </p>

                  <div class="container">

		<div class="buttons">

         <button type="submit" class="positive"><img src="/images/icons/database_go.png" alt=""/> 

        		Query the Database</button>

      </div>

      </div>

      </p>

   </form>

 <?php } ?>

</div>

</body>

</html>

Open in new window

0
 
LVL 14

Expert Comment

by:EMB01
ID: 24099582
When centering divs, you want to set your margins to auto. I believe this is also compliant with W3C standards.
0
 

Author Comment

by:jwnrb
ID: 24100389
Didn't seem to make a difference on my end.
0
 
LVL 14

Expert Comment

by:EMB01
ID: 24100617
Would it be possible to post a sample URL so I can see what's happening visually? Thank you.
0
 

Author Comment

by:jwnrb
ID: 24101064
This is not on my production server (its on my personal server), I don't have the database running here, but that is okay anyways.  The button still behaves the same, regardless.

http://www.weinraub.net/demo.php
0
 
LVL 14

Expert Comment

by:EMB01
ID: 24101150
Okay, that does look cool, by the way.

Try this different margin approach.
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Discount-o-Matic :: Query</title>

<style type="text/css">

 

html, body

{

	height: 100%;         /* required */	

}

 

body

{

	text-align: center;   /* horizontal centering hack for IE */

	padding: 0;           /* required to "hide" distance div */

	margin: 0;            /* required to "hide" distance div */

	font-family:Arial, Helvetica, sans-serif;     /* optional font */

	font-size:12px;       /* optional size */

	color: #000000;       /* optional colour */

 

}

 

div#horizon

{

	margin-bottom: -10em; /* half of content height */

	background: red;      /* temporary - used to see div */

	width: 1px;           /* required to "hide" distance div */

	height: 50%;          /* required */

	float: left;          /* required */

}

 

div#content

{

	position: relative;   /* positions content on top of distance */

	text-align: left;     /* horizontal centering hack for IE */

	height: 20em;         /* required - desired height */

	width: 40em;          /* required - desired width */

	background: #f9fbfd;        /* cosmetic */

	border: 1px solid #d7e5f2;  /* cosmetic */

	border-collapse: collapse;  /* cosmetic */

	padding: 5px;					 /* cosmetic */

	margin: 0 auto;       /* required */

	clear: left;          /* required */

	

}

 

form

{

   text-align:center;

}

 

input.tiny

{

	border: 1px solid #99b3b4;

	width: 50px;

	background: #e4ebeb;

	font: 11px verdana, sans-serif;

	color:#009900;

	padding:3px;

	margin-bottom:4px;

	outline:none;

}

 

input.tiny:focus 

{

	border:1px solid #567475;

	background: #e4ebeb;

}

 

div#container {

 

  text-align: center ;

  margin: 0 auto ;

 

}

/* BUTTONS */

 

.buttons a, .buttons button

{

    display:block;

    float:left;

    margin:0 7px 0 0; 

    background-color:#f5f5f5;

    border:1px solid #dedede;

    border-top:1px solid #eee;

    border-left:1px solid #eee;

 

    font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;

    font-size:100%;

    line-height:130%;

    text-decoration:none;

    font-weight:bold;

    color:#565656;

    cursor:pointer;

    padding:5px 10px 6px 7px; /* Links */

}

 

.buttons button

{

    width:auto;

    overflow:visible;

    padding:4px 10px 3px 7px; /* IE6 */

}

 

.buttons button[type]

{

    padding:5px 10px 5px 7px; /* Firefox */

    line-height:17px; /* Safari */

}

 

*:first-child+html button[type]

{

    padding:4px 10px 3px 7px; /* IE7 */

}

 

.buttons button img, .buttons a img

{

    margin:0 3px -3px 0 !important;

    padding:0;

    border:none;

    width:16px;

    height:16px;

}

 

/* STANDARD */

 

button:hover, .buttons a:hover{

    background-color:#dff4ff;

    border:1px solid #c2e1ef;

    color:#336699;

}

.buttons a:active{

    background-color:#6299c5;

    border:1px solid #6299c5;

    color:#fff;

}

 

/* POSITIVE */

 

button.positive, .buttons a.positive

{

    color:#529214;

}

 

.buttons a.positive:hover, button.positive:hover

{

    background-color:#E6EFC2;

    border:1px solid #C6D880;

    color:#529214;

}

 

.buttons a.positive:active

{

    background-color:#529214;

    border:1px solid #529214;

    color:#fff;

}

 

/* NEGATIVE */

 

.buttons a.negative, button.negative

{

    color:#d12f19;

}

 

.buttons a.negative:hover, button.negative:hover

{

    background:#fbe3e4;

    border:1px solid #fbc2c4;

    color:#d12f19;

}

 

.buttons a.negative:active

{

    background-color:#d12f19;

    border:1px solid #d12f19;

    color:#fff;

}

 

</style>

</head>

 

<body>

<?php include_once("db.php"); ?>

	

<div id="horizon"></div>

<div id="content">

   <!-- absolutely centred content -->

  

   <?php

    if ( isset( $_POST['authCode'] ) )

	 {

	    $authLookup = strtoupper($_POST['authCode']);

       $database = "discount-o-matic";

		 $query    = "SELECT customer, location, discount, competition, reason, authCode, camera, name FROM discount 

INNER JOIN cameras ON discount.cid = cameras.cid

INNER JOIN salesmen ON discount.uid = salesmen.uid

WHERE authCode = '$authLookup'";

          @mysql_connect($sql['host'], $sql['user'], $sql['pass']);

          mysql_select_db($database);

          $result = mysql_query($query);

          while ( $row = mysql_fetch_object( $result ) )

          { 

			    // replace with a table

				 // and centre results; 

             echo "Customer: " . "<strong>$row->customer</strong><br />";

				 echo "Location: " . "<strong>$row->location</strong><br />";

				 echo "Discount: " . "<strong>$row->discount</strong><br />";

				 echo "Competition: " . "<strong>$row->competition</strong><br />";

				 echo "Reason: " . "<strong>$row->reason</strong><br />";

				 echo "Authorization Code: " . "<strong>$row->authCode</strong><br />";

				 echo "Camera: " . "<strong>$row->camera</strong><br />";

				 echo "Salesman: " . "<strong>$row->name</strong><br />";				 

          }

             mysql_free_result($result);

	 }

	 else

	 {

	 // this needs to be centred too, the button and shiznit

?>   

   <form id="frmQuery" name="frmQuery" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">

      <p>Please Key in the Authorization Code to Query the Database </p>

      <p>

         <input name="authCode" type="text" class="tiny" id="authCode" />

      </p>

                  <div class="container">

		<div class="buttons">

         <button type="submit" class="positive"><img src="/images/icons/database_go.png" alt=""/> 

        		Query the Database</button>

      </div>

      </div>

      </p>

   </form>

 <?php } ?>

</div>

</body>

</html>

Open in new window

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:jwnrb
ID: 24101414
Nope, looks the same to me, still.  
Weird, i know! :-/
0
 

Author Comment

by:jwnrb
ID: 24101437
Is it possible that how I centre everything on the horizon causing this not to work, possibly?
0
 
LVL 42

Accepted Solution

by:
David S. earned 200 total points
ID: 24101554
You gave ".buttons button" float:left which left aligns it. To center it don't float it and give it "margin:0 auto", as EMB01 suggested.
0
 
LVL 14

Assisted Solution

by:EMB01
EMB01 earned 200 total points
ID: 24101583
... Well, then; this may seem pathetic but it can't hurt!
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Discount-o-Matic :: Query</title>

<style type="text/css">

 

html, body

{

	height: 100%;         /* required */	

}

 

body

{

	text-align: center;   /* horizontal centering hack for IE */

	padding: 0;           /* required to "hide" distance div */

	margin: 0;            /* required to "hide" distance div */

	font-family:Arial, Helvetica, sans-serif;     /* optional font */

	font-size:12px;       /* optional size */

	color: #000000;       /* optional colour */

 

}

 

div#horizon

{

	margin-bottom: -10em; /* half of content height */

	background: red;      /* temporary - used to see div */

	width: 1px;           /* required to "hide" distance div */

	height: 50%;          /* required */

	float: left;          /* required */

}

 

div#content

{

	position: relative;   /* positions content on top of distance */

	text-align: left;     /* horizontal centering hack for IE */

	height: 20em;         /* required - desired height */

	width: 40em;          /* required - desired width */

	background: #f9fbfd;        /* cosmetic */

	border: 1px solid #d7e5f2;  /* cosmetic */

	border-collapse: collapse;  /* cosmetic */

	padding: 5px;					 /* cosmetic */

	margin: 0 auto;       /* required */

	clear: left;          /* required */

	

}

 

form

{

   text-align:center;

}

 

input.tiny

{

	border: 1px solid #99b3b4;

	width: 50px;

	background: #e4ebeb;

	font: 11px verdana, sans-serif;

	color:#009900;

	padding:3px;

	margin-bottom:4px;

	outline:none;

}

 

input.tiny:focus 

{

	border:1px solid #567475;

	background: #e4ebeb;

}

 

div#container {

 

  text-align: center ;

  margin: 0 auto ;

 

}

/* BUTTONS */

 

.buttons a, .buttons button

{

    display:block;

    float:left;

    margin:0 7px 0 0; 

    background-color:#f5f5f5;

    border:1px solid #dedede;

    border-top:1px solid #eee;

    border-left:1px solid #eee;

 

    font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;

    font-size:100%;

    line-height:130%;

    text-decoration:none;

    font-weight:bold;

    color:#565656;

    cursor:pointer;

    padding:5px 10px 6px 7px; /* Links */

}

 

.buttons button

{

    width:auto;

    overflow:visible;

    padding:4px 10px 3px 7px; /* IE6 */

}

 

.buttons button[type]

{

    padding:5px 10px 5px 7px; /* Firefox */

    line-height:17px; /* Safari */

}

 

*:first-child+html button[type]

{

    padding:4px 10px 3px 7px; /* IE7 */

}

 

.buttons button img, .buttons a img

{

    margin:0 3px -3px 0 !important;

    padding:0;

    border:none;

    width:16px;

    height:16px;

}

 

/* STANDARD */

 

button:hover, .buttons a:hover{

    background-color:#dff4ff;

    border:1px solid #c2e1ef;

    color:#336699;

}

.buttons a:active{

    background-color:#6299c5;

    border:1px solid #6299c5;

    color:#fff;

}

 

/* POSITIVE */

 

button.positive, .buttons a.positive

{

    color:#529214;

}

 

.buttons a.positive:hover, button.positive:hover

{

    background-color:#E6EFC2;

    border:1px solid #C6D880;

    color:#529214;

}

 

.buttons a.positive:active

{

    background-color:#529214;

    border:1px solid #529214;

    color:#fff;

}

 

/* NEGATIVE */

 

.buttons a.negative, button.negative

{

    color:#d12f19;

}

 

.buttons a.negative:hover, button.negative:hover

{

    background:#fbe3e4;

    border:1px solid #fbc2c4;

    color:#d12f19;

}

 

.buttons a.negative:active

{

    background-color:#d12f19;

    border:1px solid #d12f19;

    color:#fff;

}

 

</style>

</head>

 

<body>

<?php include_once("db.php"); ?>

	

<div id="horizon"></div>

<div id="content">

   <!-- absolutely centred content -->

  

   <?php

    if ( isset( $_POST['authCode'] ) )

	 {

	    $authLookup = strtoupper($_POST['authCode']);

       $database = "discount-o-matic";

		 $query    = "SELECT customer, location, discount, competition, reason, authCode, camera, name FROM discount 

INNER JOIN cameras ON discount.cid = cameras.cid

INNER JOIN salesmen ON discount.uid = salesmen.uid

WHERE authCode = '$authLookup'";

          @mysql_connect($sql['host'], $sql['user'], $sql['pass']);

          mysql_select_db($database);

          $result = mysql_query($query);

          while ( $row = mysql_fetch_object( $result ) )

          { 

			    // replace with a table

				 // and centre results; 

             echo "Customer: " . "<strong>$row->customer</strong><br />";

				 echo "Location: " . "<strong>$row->location</strong><br />";

				 echo "Discount: " . "<strong>$row->discount</strong><br />";

				 echo "Competition: " . "<strong>$row->competition</strong><br />";

				 echo "Reason: " . "<strong>$row->reason</strong><br />";

				 echo "Authorization Code: " . "<strong>$row->authCode</strong><br />";

				 echo "Camera: " . "<strong>$row->camera</strong><br />";

				 echo "Salesman: " . "<strong>$row->name</strong><br />";				 

          }

             mysql_free_result($result);

	 }

	 else

	 {

	 // this needs to be centred too, the button and shiznit

?>   

   <form id="frmQuery" name="frmQuery" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">

      <p>Please Key in the Authorization Code to Query the Database </p>

      <p>

         <input name="authCode" type="text" class="tiny" id="authCode" />

      </p>

                  <div class="container">

		<div class="buttons">

<p align="center">

         <button type="submit" class="positive"><img src="/images/icons/database_go.png" alt=""/> 

        		Query the Database</button>

</p>

      </div>

      </div>

      </p>

   </form>

 <?php } ?>

</div>

</body>

</html>

Open in new window

0
 
LVL 14

Expert Comment

by:EMB01
ID: 24101596
I would take Kravs advice, he knows what he's talking about more than me. Thanks, Krav!
0
 

Author Comment

by:jwnrb
ID: 24101744
Wicked!
0
 

Author Comment

by:jwnrb
ID: 24101764
So, was it simply just making that ONE change, or in conjunction with the other changes that EMB offered?  Should points be split?

I want to be fair here.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now