473,698 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tables positioning

30 New Member
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 1486
drhowarddrfine
7,435 Recognized Expert Expert
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 Recognized Expert Expert
</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
2707
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 attempts I've concluded "no". Thank you,
81
5159
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 the blogs, and one definitely didn't print right. Surveying the web, my impression is that CSS is very unreliable, because even updated browsers fail to implement the standards correctly. So should one just avoid CSS? Or is it OK if used...
54
7223
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 set of pages that get the w3c tick for XHTML 1.0 Strict, and CSS2. So far, I have succeeded, thanks to the great information in these groups. Now, however, I'm having trouble. A few days ago, I read a thread that dealt with this issue of...
1
1893
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 coordinates. (It always seemed odd to me that there is no function called GetExtent that would return the bounding rectangle of an object -- this would solve my problem). There is a way, however, to fetch the coordinates of an object (such as a table, or...
5
1879
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. So the problem I am having at the moment is that if the table gets longer by one or two rows, all my alignment goes of out whack for the other tables. Is there a way for example to place table #2 right after table#1 ends?
7
6529
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 that they are still using HTML Tables for content. I realize that many sites still use HTML Tables for their content, but it is generally discouraged in favor of CSS Layers.
3
1890
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 column layout: header nav content
6
1511
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 been using tables so far to define the layout and use % based sizes so things stretch or shrink to fit the screen size. It works fine. I read about using DIVs and saw this approach being used in some MS Asp.net
2
1953
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 that I have used top margins to position the tables in the ASP page. So the tables when repeated super-impose on the tables that are already placed at that margin position. Can someone suggest me a better way out to resolve this?
53
4119
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 javascript object and that's all. No need to know CSS hacks, no need to clutter your html with tables. http://www.bravelayout.scarabeo.biz/Quickstart
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.