473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Tables positioning

30
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.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include('includes/corefuncs.php');
  3. if (function_exists('nukeMagicQuotes')) {
  4.    nukeMagicQuotes();
  5.    }
  6.  
  7. /////////////////////////////////////////////////
  8.  
  9. //go ahead only if not suspect and all required fields OK
  10. if (!$suspect && empty($missing)) {
  11.      //set defaul values for variables that might not exist
  12.      $quote = isset($quote) ? $subscribe : 'Nothing Selected';
  13. }
  14. ///////////////////////////////////////////////////////////
  15.  
  16. $subject = 'Project Idea';
  17.  
  18. //list expected feilds
  19.    $expected = array('name', 'email', 'comments', 'budget', 'quote');
  20. //set required fields
  21.    $required = array('name', 'comments', 'email');
  22. //creat an empty array for any missing fields
  23. $missing = array();
  24.  
  25. ///////////////////////////////////////////////////////////
  26.  
  27. //process email
  28. if (array_key_exists('send', $_POST)) {
  29.    $to = 'goldfishgraphics@gmail.com'; //my email
  30.    $subject = 'Project Idea';
  31.  
  32.  
  33.  
  34.  
  35. //create empty array for any missing fields
  36. $missing = array();
  37. //assume that there is nothing suspect
  38. $suspect = false;
  39. //create a pattern to locate suspect phrases
  40. $pattern = '/Content-Type:|Bcc:|Cc:/i';
  41.  
  42. //function to check for suspect phrases
  43. function isSuspect($val, $pattern, &$suspect) {
  44.      // if the variable is an array, loop through each element
  45.      // and pass it recursively back to the same function
  46.      if (is_array($val)) {
  47.          foreach ($val as $item) {
  48.              isSuspect($item, $pattern, $suspect);
  49.          }
  50.      }
  51.      else {
  52.          // if one of the suspect phrases is found, set Boolean to tur
  53.          if (preg_match($pattern, $val)) {
  54.              $suspect = true;
  55.          }
  56.      }
  57. }
  58.  
  59. // check the $_POST array and any subarrays for suspect content
  60. isSuspect($_POST, $pattern, $suspect);
  61.  
  62. if ($suspect) {
  63.      $mailSent = false;
  64.      unset($missing);
  65. }
  66. else {
  67.  
  68. //process the $_POST variables
  69. foreach ($_POST as $key => $value) {
  70.      //asign to temporary variable and strip whitespace if not an array
  71. $temp = is_array($value) ? $value : trim($value);
  72.      //if empty and required, add to $missing array
  73.      if (empty($temp) && in_array($key, $required)) {
  74.          array_push($missing, $key);
  75.      }
  76.      //otherwise, assign to a variable of the same name as $key
  77.      elseif (in_array($key, $expected)) {
  78.          ${$key} = $temp;
  79.      }
  80. }
  81. }
  82. //build the message
  83.  
  84. //go ahead if required feilds are in
  85. if (!$suspect && empty($missing)) {
  86.  
  87. //build message
  88.    $message = "Name: $name\n\n";
  89.    $message .= "Email: $email\n\n";
  90.    $message = "Budget: $budget\n\n";
  91.    $message = "Quote: $quote\n\n";
  92.    $message .= "Comments: $comments";
  93.  
  94. //limit line length to 65 characters
  95.    $message = wordwrap($message, 65);
  96.  
  97. // send it
  98. $mailSent = mail($to, $subject, $message);
  99. if ($mailsent) {
  100.    //missing is no longer needed if the meail is sent, so unset it
  101.    unset($missing);
  102.      }
  103.       }
  104.      }
  105.  
  106. ?>
  107.  
  108.  
  109. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  110. "http://www.w3.org/TR/xhtmll/DTD/xhtml1-strict.dtd">
  111. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  112.  
  113. <head>
  114.  
  115. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  116.  
  117. <title>Goldfish Graphics</title>
  118.  
  119. <link type="text/css" rel="stylesheet" href="Goldfish.css" />
  120.  
  121. <style type="text/css">
  122. <!--
  123. A {text-decoration:none}
  124. -->
  125. </style>
  126.  
  127. </head>
  128. <body>
  129.  
  130. <div id="container">
  131.  
  132. <div id="banner">
  133. <img src="images/banner.jpg" alt= "Goldfish Graphics Banner Image" />
  134. </div>
  135.  
  136.  
  137. <div id="navigation">
  138. <div id="hvan">
  139. <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>
  140. </div>
  141. </div>
  142.  
  143.  
  144. <div id="sidebar">
  145.  
  146. <div id="texto">
  147.  
  148. <h4 class="sidebar"> Testimonies</h4>
  149. <p>
  150. <?php include('testmonies.php'); ?>
  151.  
  152. </p>
  153.  
  154. </div>
  155. <h4>Links</h4>
  156.  
  157. <div id="links">
  158.  
  159. <div class="nav">
  160. <p>
  161. <?php
  162. @include('includes/links.html');
  163. ?>
  164.  
  165. </p>
  166. </div>
  167.  
  168.  
  169. </div>
  170. </div>
  171.  
  172.  
  173.  
  174. <div id="content">
  175. <div id="text">
  176. <h2>Contact</h2>
  177. <p id="home">
  178.  
  179.  
  180. <form id="feedback" method="post" action="">
  181.  
  182. <table>
  183. <tr>
  184. <td>
  185.      <label for="name">Name:</label>
  186.      <input name="name" id="name" type="text" class="formbox"
  187.      <?php if (isset($missing)) {
  188.        echo 'value="'.htmlentities($_POST['name']).'"';
  189.      } ?>/> *
  190.  
  191. </td>
  192. <td>
  193.  
  194.      <label for="budget">Budget:</label>
  195.      <input name="budget" id="budget" type="text" class="formbox"
  196.      <?php if (isset($missing)) {
  197.        echo 'value="'.htmlentities($_POST['budget']).'"';
  198.      } ?>/>
  199.  
  200. </td>    
  201.    </tr>    
  202.  
  203.  
  204.    <tr>
  205.    <td>
  206.        <label for="email">Email:</label>
  207.      <input name="email" id="email" type="text" class="formbox"
  208.      <?php if (isset($missing)) {
  209.        echo 'value="'.htmlentities($_POST['email']).'"';
  210.      } ?>/> *
  211.    </td>
  212.  
  213.    <td>
  214.    Free quote?
  215.    <input name="quote" type="radio" value="Yes" id="Free Quote"
  216.    <?php
  217.    $OK = isset($_POST['quote']) ? true : false;
  218.    if ($OK && isset($missing) && $_POST['quote'] == 'Yes') { ?>
  219.        checked="checked"
  220.    <?php } ?>
  221.    />
  222.    <label for="quote-yes">Yes</label>
  223.    <input name="quote" type="radio" value="No" id="subscribe-no"
  224.    <?php
  225.    if ($OK && isset($missing) && $_POST['quote'] == 'No') { ?>
  226.        checked="checked"
  227.    <?php } ?>
  228.    />
  229.  
  230.    <label for="quote-no">No</label>
  231.  
  232.    </td>
  233. </tr>
  234.  
  235.    <tr>
  236.    <td>
  237.      <label for="comments">Prodject Description: *</label>
  238.      <textarea name="comments" id="comments" cols="54" rows="5"><?php
  239.      if (isset($missing)) {
  240.          echo htmlentities($_POST['comments']);
  241.      } ?></textarea>
  242.      </td>
  243.      <td>
  244.      </td>
  245.    </tr>
  246.  
  247.  
  248.    <tr>
  249.    <td>
  250.      <input name="send" id="send" type="submit" value="Submit" />
  251.    </td>
  252.    <td>
  253.    </td>
  254.    </tr>
  255.  
  256.    </tabel>
  257. </form>
  258.  
  259.  
  260.  
  261. <?php
  262. if ($_POST && isset($missing)) {
  263. ?>
  264.    <p class="warning">Please complete all required missing item(s).</p>
  265. <?php
  266.   }
  267. elseif ($_POST && !$mailSent) {
  268. ?>
  269.    <p class="warning">Sorry, there was a problem sending your message. Please try later.</p>
  270. <?php
  271.   }
  272. elseif ($_POST && $mailSent) {
  273. ?>
  274.    <p><strong>Your message has been sent. Thank you.
  275. </strong></p>
  276. <?php }?>
  277.  
  278. </p>
  279.  
  280. <p id="news">
  281. If you have questions, comments, or troubles with the form above, you can also contact me at goldfishgraphics@gmail.com.
  282. </p>
  283. </div>
  284. </div>
  285.  
  286. <div id="footer">
  287. </div>
  288.  
  289.  
  290.  
  291. </div>
  292.  
  293.  
  294. </body>
  295. </html>
  296.  

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.
Expand|Select|Wrap|Line Numbers
  1.  
  2. body {
  3.  
  4. background-color: #5f656b;
  5. font-family: Tahoma, "Arial Unicode MS", Arial, sans-serif, serif;
  6. font-size: .8em;
  7. color: #eea103
  8.  
  9. }
  10.  
  11.  
  12.  
  13. /*July 8th 2007*/
  14.  
  15.  
  16.  
  17. #content {
  18.  
  19. height: 505px;
  20. width: 518px;
  21. background-image: url(images/content.jpg);
  22. background-repeat: no-repeat;
  23. margin-top: 4%;
  24. margin-left: 27.2%;
  25.  
  26. }
  27.  
  28.  
  29. #sidebar {
  30.  
  31. height: 505px;
  32. width: 153px;
  33. background-image: url(images/sidebar.jpg);
  34. background-repeat: no-repeat;
  35. margin-top: 4%;
  36. padding-top: 3%;
  37. padding-left: 3.5%;
  38. margin-left: auto;
  39. float: left;
  40.  
  41. }
  42.  
  43. #linkscss {
  44.  
  45. padding-left: .8%;
  46. padding-right: .8%;
  47. padding-top: 4%;
  48. width: 105px;
  49.  
  50. }
  51.  
  52.  
  53.  
  54. #navigation {
  55.  
  56. margin: 0%;
  57. padding-top: 0%;
  58. border-width: 0px;
  59. height: 28px;
  60.  
  61. }
  62.  
  63.  
  64. #banner {
  65.  
  66. border-width: 0px;
  67. margin: 0%;
  68. padding: 0%;
  69. margin-top: 0%;
  70. height: 119px;
  71.  
  72. }
  73.  
  74.  
  75. #footer {
  76.  
  77. height: 28px;
  78. width: 712px;
  79. background-image: url(images/footer.jpg);
  80. background-repeat: no-repeat;
  81. margin-top: 4.2%;
  82.  
  83. }
  84.  
  85. #container {
  86.  
  87. width: 712px;
  88. margin: auto;
  89. position: relative;
  90. padding: 0%;
  91. background-color: #3c4246;
  92.  
  93. }
  94.  
  95.  
  96. #home {
  97.  
  98. width: 442px;
  99.  
  100. }
  101.  
  102. #news {
  103.  
  104. width: 442px;
  105.  
  106. }
  107.  
  108.  
  109. #texto {
  110.  
  111. padding-left: .8%;
  112. padding-right: .8%;
  113. padding-top: 6%;
  114. width: 105px;
  115.  
  116. }
  117.  
  118.  
  119. #text {
  120.  
  121. padding-left: 5.5%;
  122. padding-top: 5%;
  123. padding-right: 5.5%;
  124.  
  125. }
  126.  
  127. #footer {
  128.  
  129. padding-top: .01%;
  130. padding-left: 3%;
  131. font-size: .7em;
  132. }
  133.  
  134.  
  135.  
  136.  
  137. #links {
  138.  
  139. padding: 0%;
  140. margin: 0%;
  141.  
  142. }
  143.  
  144. #navigation {
  145.  
  146. height: 28px;
  147. width: 712px;
  148. background-image: url(images/navigation.jpg);
  149. background-repeat: no-repeat;
  150. margin-top: 0%;
  151.  
  152. }
  153.  
  154. #hvan {
  155.  
  156. margin-left: 28.5%;
  157. padding-top: .7%;
  158. padding-bottom: 1%;
  159.  
  160.  
  161. }
  162.  
  163.  
  164. h4.sidebar {
  165. margin: 0px;
  166. padding: 0px;
  167. padding-top: 15%;
  168. }
  169.  
  170.  
  171. /*Should change form colors*/
  172.  
  173. #quotel {
  174.  
  175.  
  176. }
  177.  
  178. .quote {
  179.  
  180. }
  181.  
  182.  
  183. .name {
  184. font-size: 14px;
  185. background-color: #575b64;
  186. border: 1px solid #eea103;
  187. color: #eea103;
  188.  
  189. }
  190.  
  191. .budget {
  192. font-size: 14px;
  193. background-color: #575b64;
  194. border: 1px solid #eea103;
  195. color: #eea103;
  196.  
  197. }
  198.  
  199. .email {
  200. font-size: 14px;
  201. background-color: #575b64;
  202. border: 1px solid #eea103;
  203. color: #eea103;
  204.  
  205. }
  206.  
  207. textarea {
  208. background-color: #575b64;
  209. border: 1px solid #eea103;
  210. color: #eea103;
  211.  
  212. }
  213.  
  214. input {
  215. background-color: #575b64;
  216. border: 1px solid #eea103;
  217. color: #eea103
  218. }
  219.  
  220. a:link {
  221. color: #ef9f02;
  222.  
  223. }
  224.  
  225. a:visited {
  226. color: #ef9f02;
  227. }
  228.  
  229. a:hover {
  230. color: #ae6d1b;
  231.  
  232. }
  233.  
  234. a:active {
  235. color: #ef9f02;
  236.  
  237. }
  238.  
  239. table {
  240.   margin-left: 0px;
  241.   margin-right: 30px;
  242. }
  243.  
  244. td, th {
  245. padding: 0px;
  246. margin: 0px;
  247. }
  248.  
  249.  
  250. .nav a {
  251.  
  252. color: #ef9f02;
  253. text-decoration: none;
  254.  
  255. }
  256.  
  257. .nav a:visited {
  258. color: #ef9f02;
  259. text-decoration: none;
  260.  
  261. }
  262.  
  263. .nav a:hover {
  264.  
  265. color: #ae6d1b;
  266. text-decoration: underline;
  267.  
  268. }
  269.  
  270.  
  271. .nav a:active {
  272.  
  273. color: #ef9f02;
  274.  
  275. }
  276.  
Aug 5 '07 #1
2 1459
drhowarddrfine
7,435 Expert 4TB
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.
Aug 5 '07 #2
drhowarddrfine
7,435 Expert 4TB
</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.
Aug 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

40
by: Mason A. Clark | last post by:
CSS Experts: OK, I'm a stupid newby. Now, here's the question: Can CSS replace slightly complicated Tables and work in three browsers (e.g. MSIE 6.0, Net 7.1, Op 7.03) ? After countless...
81
by: sinister | last post by:
I wanted to spiff up my overly spartan homepage, and started using some CSS templates I found on a couple of weblogs. It looks fine in my browser (IE 6.0), but it doesn't print right. I tested...
54
by: Max Quordlepleen | last post by:
Apologies for the crossposting, I wasn't sure which of these groups to ask this in. I have been lurking in these groups for a week or so, trying to glean what I need to design a simple, clean...
1
by: Siegfried Heintze | last post by:
I want to implement drag and drop for tables, divs, spans. The problem is that I don't know how wide or long my tables, divs and spans are going to be in advance so I cannot use absolute...
5
by: aljamala | last post by:
Hi, I have a group of 5 tables laid out of the web page. 2 go on the left side and 3 on the right. These tables retrieve data from the database so the number of records (rows) returned varies....
7
by: www.gerardvignes.com | last post by:
I was checking out a website offered as an example for another job, and I was struck by how clean and professional the site is. http://www.colorlines.com/ I was poking around, and I noticed...
3
by: Rangy | last post by:
Hi, I've decided to take the plunge and move from tables to a pure css layout. I still "think" in tables when I do my layouts and I was wondering the following: I have a simple, standard two...
6
by: =?Utf-8?B?Tkg=?= | last post by:
Hi, What do you recommend for defining the layout of an asp.net 2.0 page? Leaving masterpages and user controls aside for the moment is the use of tables or Divs the best approach? I have...
2
by: marijuanated | last post by:
Hi All, I am generating a series of tables in CSS. The tables should repeat themselves for a number of times governed by a counter that is calculated at runtime by the ASP code. The problem is...
53
by: brave1979 | last post by:
Please check out my javascript library that allows you to create any layout for your web page, nested as deep as you like, adjusting to width and height of a browser window. You just describe it in...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.