mindapolis Posted October 22, 2015 Share Posted October 22, 2015 Hi, on http://mediaservicesunlimited.com/contactUs.php I dont like that the company name, state and zip are so far away from the other text. I thought if I added the colspan to the <tr> in the projectOptions table, that would solve the problem but it didn't. Any suggestions? <?php require_once('functions.php'); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> td { margin-bottom:110px; } </style> <title>Untitled Document</title> </head> <body> <table id="contactForm"> <?Php $errors=array(); if(isset($_POST['submit'])) { validate_input(); display_form(); function validate_input() { global $errors; if($_POST["fname"] == " ") { $errors['fname']="<font color ='red'> Please enter your first name </font>"; } } } ?> <form method="post"> <tr> <td class="question" >First Name:<br /> <input type="text" name="fname" size="15" value =<?php echo $_POST[fname];?> > <?php echo $errors['fname']; ?></td> <td class="question">Last Name<br /> <input type="text" name="lname" size="20"> </td> <td class="question">Organization's Name:<br /> <input type="text" name="orgName" size="15" maxlength="50"> </td> </tr> <tr> <td class="question">Street Address: <br /> <input type="text" name="address" size="15" maxlength="50"></td> <td class="question">City: <br /> <input type="text" name="city" size="10" maxlength="25"> </td> <td class="question">State: <br /> <select name = "state" value="<?=$state?>"> <option value ="Please choose a state"> Please choose a state</option> <?php states($state); ?> </select> </td> <td class="question">Zipcode:<br /> <input type="number" name="zipcode" size="5" maxlength="5"> </td> </tr> <tr> <td>Phone Number: <br />(including area code) <br /> <input type="text" name="phone" size="10" maxlength="10"></td> <td>Fax Number: <br />(including area code) <br /> <input type="text" name="fax" size="10" maxlength="10"></td> </tr> <tr> <td>Email:<br /> <input type="text" name="email" /></td> <td>Confirm Email:<br /> <input type="text" name="ConfirmEmail" /></td> </tr> <tr> <td>What would you like help with? </td> <td><table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media </td> <td><input type="checkbox" name="WebContentManagement">Web Content Management </td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing </td> <td><input type="checkbox" name="WebDesign">Web Design </td> </tr> </table></td> <tr> <td>Overview about the project: </td> <td><textarea></textarea></td> </tr> <tr> <td>If you are not a robot, what year is it? </td> <td><input type="text" name="year" size="4" maxlength="4"> </tr> <tr> <td><input type="submit" value="Contact Me!"></td> <td><input type="reset"></td> </tr> </form> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/298764-table-colspan/ Share on other sites More sharing options...
benanamen Posted October 22, 2015 Share Posted October 22, 2015 You don't use tables to format a form or page. You need to use CSS. Quote Link to comment https://forums.phpfreaks.com/topic/298764-table-colspan/#findComment-1523989 Share on other sites More sharing options...
Psycho Posted October 22, 2015 Share Posted October 22, 2015 benanamen is correct, tables should not be used for the purpose of layouts. But, to provide an answer to your problem - colspans do not apply to TR tags. A TR is just to define a row. The rowspan attribute applies to TD elements to state whether they should take multiple columns. So, you could do the following: - Add a colspan="2" to the Organization name TD - Add a collspan="3" to the last TD in each row starting with the Fax number Quote Link to comment https://forums.phpfreaks.com/topic/298764-table-colspan/#findComment-1523991 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.