Tables positioning

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bouzy
    New Member
    • Jun 2007
    • 30

    Tables positioning

    I have been trying to make some very basic forms. Everything I think should work once I get it on my server, but it looks like crap. I know you are supposed to use tables for an easy way to position. I know really nothing about tables. I just sort of guessed on what to do this is what I came up with.

    Code:
    <?php
    include('includes/corefuncs.php');
    if (function_exists('nukeMagicQuotes')) {
       nukeMagicQuotes();
       }
      
    /////////////////////////////////////////////////
    
    //go ahead only if not suspect and all required fields OK
    if (!$suspect && empty($missing)) {
         //set defaul values for variables that might not exist
         $quote = isset($quote) ? $subscribe : 'Nothing Selected';
    }
    ///////////////////////////////////////////////////////////
    
    $subject = 'Project Idea';
    
    //list expected feilds
       $expected = array('name', 'email', 'comments', 'budget', 'quote');
    //set required fields
       $required = array('name', 'comments', 'email');
    //creat an empty array for any missing fields
    $missing = array();
    
    ///////////////////////////////////////////////////////////
    
    //process email
    if (array_key_exists('send', $_POST)) {
       $to = 'goldfishgraphics@gmail.com'; //my email
       $subject = 'Project Idea';
    
      
    
      
    //create empty array for any missing fields
    $missing = array();
    //assume that there is nothing suspect
    $suspect = false;
    //create a pattern to locate suspect phrases
    $pattern = '/Content-Type:|Bcc:|Cc:/i';
    
    //function to check for suspect phrases
    function isSuspect($val, $pattern, &$suspect) {
         // if the variable is an array, loop through each element
         // and pass it recursively back to the same function
         if (is_array($val)) {
             foreach ($val as $item) {
                 isSuspect($item, $pattern, $suspect);
             }
         }
         else {
             // if one of the suspect phrases is found, set Boolean to tur
             if (preg_match($pattern, $val)) {
                 $suspect = true;
             }
         }
    }
    
    // check the $_POST array and any subarrays for suspect content
    isSuspect($_POST, $pattern, $suspect);
    
    if ($suspect) {
         $mailSent = false;
         unset($missing);
    }
    else {
    
    //process the $_POST variables
    foreach ($_POST as $key => $value) {
         //asign to temporary variable and strip whitespace if not an array
    $temp = is_array($value) ? $value : trim($value);
         //if empty and required, add to $missing array
         if (empty($temp) && in_array($key, $required)) {
             array_push($missing, $key);
         }
         //otherwise, assign to a variable of the same name as $key
         elseif (in_array($key, $expected)) {
             ${$key} = $temp;
         }
    }
    }
    //build the message
    
    //go ahead if required feilds are in
    if (!$suspect && empty($missing)) {
    
    //build message
       $message = "Name: $name\n\n";
       $message .= "Email: $email\n\n";
       $message = "Budget: $budget\n\n";
       $message = "Quote: $quote\n\n";
       $message .= "Comments: $comments";
      
    //limit line length to 65 characters
       $message = wordwrap($message, 65);
    
    // send it
    $mailSent = mail($to, $subject, $message);
    if ($mailsent) {
       //missing is no longer needed if the meail is sent, so unset it
       unset($missing);
         }
          }
         }
    
    ?>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtmll/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    
    <title>Goldfish Graphics</title>
    
    <link type="text/css" rel="stylesheet" href="Goldfish.css" />
    
    <style type="text/css">
    <!--
    A {text-decoration:none}
    -->
    </style>
    
    </head>
    <body>
    
    <div id="container">
    
    <div id="banner">
    <img src="images/banner.jpg" alt= "Goldfish Graphics Banner Image" />
    </div>
    
    
    <div id="navigation">
    <div id="hvan">
    <a href="index.php">Home</a> &nbsp; &nbsp; &nbsp; &nbsp;  <a href="services.php">Services</a> &nbsp; &nbsp; &nbsp; &nbsp;  <a href="portfolio.php">Portfolio</a> &nbsp; &nbsp; &nbsp; &nbsp; <a href="contact.php">Contact</a>
    </div>
    </div>
    
    
    <div id="sidebar">
    
    <div id="texto">
    
    <h4 class="sidebar"> Testimonies</h4>
    <p>
    <?php include('testmonies.php'); ?>
    
    </p>
    
    </div>
    <h4>Links</h4>
    
    <div id="links">
    
    <div class="nav">
    <p>
    <?php
    @include('includes/links.html');
    ?>
    
    </p>
    </div>
    
    
    </div>
    </div>
    
    
    
    <div id="content">
    <div id="text">
    <h2>Contact</h2>
    <p id="home">
    
    
    <form id="feedback" method="post" action="">
      
    <table>
    <tr>
    <td>
         <label for="name">Name:</label>
         <input name="name" id="name" type="text" class="formbox"
         <?php if (isset($missing)) {
           echo 'value="'.htmlentities($_POST['name']).'"';
         } ?>/> *
        
    </td>
    <td>
    
         <label for="budget">Budget:</label>
         <input name="budget" id="budget" type="text" class="formbox"
         <?php if (isset($missing)) {
           echo 'value="'.htmlentities($_POST['budget']).'"';
         } ?>/>
        
    </td>    
       </tr>    
      
          
       <tr>
       <td>
           <label for="email">Email:</label>
         <input name="email" id="email" type="text" class="formbox"
         <?php if (isset($missing)) {
           echo 'value="'.htmlentities($_POST['email']).'"';
         } ?>/> *
       </td>
    
       <td>
       Free quote?
       <input name="quote" type="radio" value="Yes" id="Free Quote"
       <?php
       $OK = isset($_POST['quote']) ? true : false;
       if ($OK && isset($missing) && $_POST['quote'] == 'Yes') { ?>
           checked="checked"
       <?php } ?>
       />
       <label for="quote-yes">Yes</label>
       <input name="quote" type="radio" value="No" id="subscribe-no"
       <?php
       if ($OK && isset($missing) && $_POST['quote'] == 'No') { ?>
           checked="checked"
       <?php } ?>
       />
      
       <label for="quote-no">No</label>
      
       </td>
    </tr>
    
       <tr>
       <td>
         <label for="comments">Prodject Description: *</label>
         <textarea name="comments" id="comments" cols="54" rows="5"><?php
         if (isset($missing)) {
             echo htmlentities($_POST['comments']);
         } ?></textarea>
         </td>
         <td>
         </td>
       </tr>
    
    
       <tr>
       <td>
         <input name="send" id="send" type="submit" value="Submit" />
       </td>
       <td>
       </td>
       </tr>
      
       </tabel>
    </form>
    
    
    
    <?php
    if ($_POST && isset($missing)) {
    ?>
       <p class="warning">Please complete all required missing item(s).</p>
    <?php
      }
    elseif ($_POST && !$mailSent) {
    ?>
       <p class="warning">Sorry, there was a problem sending your message. Please try later.</p>
    <?php
      }
    elseif ($_POST && $mailSent) {
    ?>
       <p><strong>Your message has been sent. Thank you.
    </strong></p>
    <?php }?>
    
    </p>
    
    <p id="news">
    If you have questions, comments, or troubles with the form above, you can also contact me at goldfishgraphics@gmail.com.
    </p>
    </div>
    </div>
    
    <div id="footer">
    </div>
    
    
    
    </div>
    
    
    </body>
    </html>

    Now I have the forms and tables built correctly I think, but I have no Idea how to make them look good in terms of padding and stuff. I need help. Could someone help me please hear is what I have so far.

    http://i93.photobucket .com/albums/l75/Bouz...uzy/contact.jpg

    hear is what my layout looks like on all the rest of my pages...

    http://i93.photobucket .com/albums/l75/Bouzy_Bouzy/IEGOLD.jpg
    Notice where the footter is and stuff.

    Hear is my CSS also if its needed.
    Code:
     
    body {
    
    background-color: #5f656b;
    font-family: Tahoma, "Arial Unicode MS", Arial, sans-serif, serif;
    font-size: .8em;
    color: #eea103
    
    }
    
    
    
    /*July 8th 2007*/
    
    
    
    #content {
    
    height: 505px;
    width: 518px;
    background-image: url(images/content.jpg);
    background-repeat: no-repeat;
    margin-top: 4%;
    margin-left: 27.2%;
    
    }
    
    
    #sidebar {
    
    height: 505px;
    width: 153px;
    background-image: url(images/sidebar.jpg);
    background-repeat: no-repeat;
    margin-top: 4%;
    padding-top: 3%;
    padding-left: 3.5%;
    margin-left: auto;
    float: left;
    
    }
    
    #linkscss {
    
    padding-left: .8%;
    padding-right: .8%;
    padding-top: 4%;
    width: 105px;
    
    }
    
    
    
    #navigation {
    
    margin: 0%;
    padding-top: 0%;
    border-width: 0px;
    height: 28px;
    
    }
    
    
    #banner {
    
    border-width: 0px;
    margin: 0%;
    padding: 0%;
    margin-top: 0%;
    height: 119px;
    
    }
    
    
    #footer {
    
    height: 28px;
    width: 712px;
    background-image: url(images/footer.jpg);
    background-repeat: no-repeat;
    margin-top: 4.2%;
    
    }
    
    #container {
    
    width: 712px;
    margin: auto;
    position: relative;
    padding: 0%;
    background-color: #3c4246;
    
    }
    
    
    #home {
    
    width: 442px;
    
    }
    
    #news {
    
    width: 442px;
    
    }
    
    
    #texto {
    
    padding-left: .8%;
    padding-right: .8%;
    padding-top: 6%;
    width: 105px;
    
    }
    
    
    #text {
    
    padding-left: 5.5%;
    padding-top: 5%;
    padding-right: 5.5%;
    
    }
    
    #footer {
    
    padding-top: .01%;
    padding-left: 3%;
    font-size: .7em;
    }
    
    
    
    
    #links {
    
    padding: 0%;
    margin: 0%;
    
    }
    
    #navigation {
    
    height: 28px;
    width: 712px;
    background-image: url(images/navigation.jpg);
    background-repeat: no-repeat;
    margin-top: 0%;
    
    }
    
    #hvan {
    
    margin-left: 28.5%;
    padding-top: .7%;
    padding-bottom: 1%;
    
    
    }
    
    
    h4.sidebar {
    margin: 0px;
    padding: 0px;
    padding-top: 15%;
    }
    
    
    /*Should change form colors*/
    
    #quotel {
    
    
    }
    
    .quote {
    
    }
    
    
    .name {
    font-size: 14px;
    background-color: #575b64;
    border: 1px solid #eea103;
    color: #eea103;
    
    }
    
    .budget {
    font-size: 14px;
    background-color: #575b64;
    border: 1px solid #eea103;
    color: #eea103;
    
    }
    
    .email {
    font-size: 14px;
    background-color: #575b64;
    border: 1px solid #eea103;
    color: #eea103;
    
    }
    
    textarea {
    background-color: #575b64;
    border: 1px solid #eea103;
    color: #eea103;
    
    }
    
    input {
    background-color: #575b64;
    border: 1px solid #eea103;
    color: #eea103
    }
    
    a:link {
    color: #ef9f02;
    
    }
    
    a:visited {
    color: #ef9f02;
    }
    
    a:hover {
    color: #ae6d1b;
    
    }
    
    a:active {
    color: #ef9f02;
    
    }
    
    table {
      margin-left: 0px;
      margin-right: 30px;
    }
    
    td, th {
    padding: 0px;
    margin: 0px;
    }
    
    
    .nav a {
    
    color: #ef9f02;
    text-decoration: none;
    
    }
    
    .nav a:visited {
    color: #ef9f02;
    text-decoration: none;
    
    }
    
    .nav a:hover {
    
    color: #ae6d1b;
    text-decoration: underline;
    
    }
    
    
    .nav a:active {
    
    color: #ef9f02;
    
    }
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    I know you are supposed to use tables for an easy way to position.
    Absolutely not! Never use tables for layout. In fact, tables for layout is stupid.

    I know little about PHP but I'll be looking through this for a while.

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      </table> mis-spelled.
      You have Free and Quote listed as id names but id can only be one name.

      This is what validating is for. It shows 24 html errors but your CSS is ok. Fix those errors and then we can work on positioning.

      Comment

      Working...