VinceGledhill Posted April 1, 2011 Share Posted April 1, 2011 Hello people. I am very new to PHP and have a website for microlight pilots where you can add an airfield. It is a Joomla based site and the input form can be seen here. http://microlight.co/index.php/New-Airfield I am quite prepared to re-write the whole input form again if I have to. Now here's my question. I would like the output of the form to be in an HTML table like it is on this page http://microlight.co/index.php/billaricay This is because at the moment people fill out the form, I get an e-mail with the info, and then have to put it into the airfield card manually myself. Sorry, If my explanation isn't very clear. But basically want users input into a table. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/ Share on other sites More sharing options...
nomadsoul Posted April 1, 2011 Share Posted April 1, 2011 You'll need to set up a database (check if your web host has phpAdmin). Then, your need to create a database and make a table that will store your form data, then you'll have to have a script that processes this data and another script to display it. It is not difficult but can be intimidating for a first timer. But one thing at a time: find out if you have phpAdmin, then let me know. I will try to walk you through the steps. And maybe some other members can kick-in. I am in China so my replies might be a bit anachronistic Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195415 Share on other sites More sharing options...
VinceGledhill Posted April 1, 2011 Author Share Posted April 1, 2011 Hi Nomadsoul. Thank you for your offer of help. I have set up a new database and have phpMyAdmin 3.3.3 installed on my system. Please be gentle with me, I've not used it before ever. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195479 Share on other sites More sharing options...
litebearer Posted April 1, 2011 Share Posted April 1, 2011 we now need to see (1) the structure of your db table; (2) the coding for your form Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195484 Share on other sites More sharing options...
VinceGledhill Posted April 1, 2011 Author Share Posted April 1, 2011 Hi Litebearer. Thank you for your input. The new database is bare at the moment. There are no tables whatsoever in there. This is the data I get back from the current form... ***************************** start quoted form returns ************************** Your Name : trevor Airfield Name : Billericay / Napps Field Height Above Sea Level : 200 ft General Location : 2 miles North of Billericay Co-Ordinates : N 51.29.25 E 0.25.10 Prior Permission Required : Yes Alternative Airfield : Laindon Air Ground Radio : No Radio Frequency : use safety comm Runways : 08 / 26 600m Circuits : To the South of the airstrip Remarks : runway dips to the western end no faciliies and no fuel etc. Airfiled used to be known as Brocks Farm and now appears on CAA maps as Napps field Warnings : 08 departure please turn right 26 landing angled approach in to avoid houses. Operating Hours : sr to ss Airfield Operator and Contact Details : Bob Napp 01277-840287 07968-861592 Landing Fee : see bob **************************** end quoted form returns ************************** So from that I guess that my table should be "named" and the number of fields should be 16? I won't do anything with that until someone says that it's right. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195494 Share on other sites More sharing options...
PFMaBiSmAd Posted April 1, 2011 Share Posted April 1, 2011 put it into the airfield card manually ^^^ What exactly does that involve and what is the data structure or method used to store that information? Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195497 Share on other sites More sharing options...
VinceGledhill Posted April 1, 2011 Author Share Posted April 1, 2011 At the moment the user puts it in via this form.http://www.microlight.co/index.php/New-Airfield I then take the information (from an e-mail that the form sends to me) and edit the card (HTML table) like in this page http://www.microlight.co/index.php/billaricay Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195500 Share on other sites More sharing options...
nomadsoul Posted April 2, 2011 Share Posted April 2, 2011 Yes, 16 fields (columns). And give your table and columns simple but memorable names. You should make your table columns based on your text input names. So, can you paste the html from your form? (just the form, not the entire page) So here is what your table structure may look like: For example your field names-datatypes might be: name varchar airfieldname varchar heightAboveSL int generallocation text co-ords (not sure about this one) priorpermisiion boolean alternatefield varchar airgroundradio boolean rf varchar runways float? circuits varchar remarks text warnings text ophours date/time AOCD varchar landinglee currency or default text Get that done first. Then we can deal with your input form. I'm not sure about your coordinates. Is it a calculated field (i.e doing math with your co-ords?) Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195839 Share on other sites More sharing options...
VinceGledhill Posted April 2, 2011 Author Share Posted April 2, 2011 Brilliant, thanks for that. I've started to build the DB and I've got an error message like so. Any ideas what I should do? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195843 Share on other sites More sharing options...
nomadsoul Posted April 2, 2011 Share Posted April 2, 2011 If you can copy and past the query here I will try in my own system and see what it does. But I don't see any mistakes unless the dash in co-ords is not allowed. Try coords instead Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195867 Share on other sites More sharing options...
nomadsoul Posted April 2, 2011 Share Posted April 2, 2011 yea i was right, can't use a dash: http://forums.mysql.com/read.php?10,49458,49458 Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195868 Share on other sites More sharing options...
nomadsoul Posted April 2, 2011 Share Posted April 2, 2011 change co-ords to co_ords Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195870 Share on other sites More sharing options...
PFMaBiSmAd Posted April 2, 2011 Share Posted April 2, 2011 You should add a status or approved column to your table, since you probably don't want to automatically display new submissions without reviewing (moderating) them first. I'm sure you probably have filtered out a number of spam submissions and corrected spelling and what-not in others before you put the information onto your live site. When your code inserts the row into your table, either leave the status/approved column empty or put in a value that indicates the information has been submitted but not reviewed. After you review the newly submitted information, you can change the status/approved column value to one that indicates the data should be displayed on your web site. Your code that dynamically produces the menu and displays the requested field information would check the status/approved column value and only process the ones that have been approved. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195887 Share on other sites More sharing options...
VinceGledhill Posted April 2, 2011 Author Share Posted April 2, 2011 Thanks guys. I now have a database I have found elsewhere how to connect to the DB and have the following code. <?php // open connection to mysql server // dbc is a variable $dbc = mysql_connect ('localhost','airfield_data','mypassword'); if (!dbc){ die("not connected :" . mysql_error()); } // select the database $db_selected = mysql_select_db ("airfield_data",$dbc); if (!db_selected) { die ("cant connect :" . mysql_error()); } // test $query="UPDATE "; ?> So my question is now how to write the submission script? If someone could please give me the code to add my data to the database (only one I'll do the rest obviously) Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195900 Share on other sites More sharing options...
PFMaBiSmAd Posted April 2, 2011 Share Posted April 2, 2011 Is your existing form to email page done using a Joomla extension? Because, there are form to database extensions that look like they can do everything you want. In fact, your existing form to email extension might have the ability to store the information to a database table. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195903 Share on other sites More sharing options...
VinceGledhill Posted April 2, 2011 Author Share Posted April 2, 2011 Hi PFMaBiSmAd. Thanks for your input. Yes the current "form to e-mail" is a joomla extension. It is mad4joomla http://extensions.joomla.org/extensions/contacts-and-feedback/forms/5597 Do you think I could modify this form? It would be handy because it does look like it "fits" on the website. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1195910 Share on other sites More sharing options...
nomadsoul Posted April 3, 2011 Share Posted April 3, 2011 Copy and paste your form -and just the form here and I will tell you how to alter your input values to match your column values. And if too many changes are called for, we can just make a new form. After that, we can make the script that will process the form into the table. I don't know anything about Joomla nor have I ever had need of it, so, maybe there will be things in your form that I won't recognize. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196085 Share on other sites More sharing options...
nomadsoul Posted April 3, 2011 Share Posted April 3, 2011 also i forgot to ask; is your connection script working? Type its full path in the url. I'm not sure what the $query="UPDATE "; is for. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196089 Share on other sites More sharing options...
Zane Posted April 3, 2011 Share Posted April 3, 2011 Also, you will definitely need an ID column to use as a primary key, that identifies each and every submission. So.. along with PFM's suggestion, you need 18 columns. Preferably, the id column should be the first one. You do have that option when you go to add a column... "add to beginning" Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196091 Share on other sites More sharing options...
PFMaBiSmAd Posted April 3, 2011 Share Posted April 3, 2011 Kind of a general answer - yes you could modify the form processing code of your current mad4joomla extension to insert the data into your table. This would allow you to keep getting the information via email while you get the database part working. I assume that the current script validates the data before putting it into the email and sending it. All you would need to do is escape the string data (see the mysql_real_escape_string() function), form the INSERT query, and execute the query. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196101 Share on other sites More sharing options...
VinceGledhill Posted April 3, 2011 Author Share Posted April 3, 2011 Thanks for all your input guys. I have added an ID tag and set it to auto increment and have also added the "approved" column to the DB. The problem with altering the Joomla extension page is that I don't know exactly where the code is to be found. So given that I can't get at the particular php file that holds it, I'm at a loss to do anything with it. I haven't been able to test to see if it connects to the DB because I don't know how. Please could someone give me instructions. Or do I just get on with writing my form? Then testing it as I go? Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196178 Share on other sites More sharing options...
PFMaBiSmAd Posted April 3, 2011 Share Posted April 3, 2011 In Your_path_to_joomla_install\components\com_mad4joomla\mad4joomla.php, there is a send() function that processes the from data. At about line 559 (in the version of mad4joomla that I just downloaded) is the point where the code attempts to send the email (all the data/uploaded files have been processed.) At about line 519 is the start of the loop that gets the element name/value and forms the email message body. You could add code to that loop to get the data into an array that you could then use to form an INSERT query. At about line 541 is the start of the loop that processes any uploaded files. You would need to add code to move the uploaded files to the location where you are placing them now. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196199 Share on other sites More sharing options...
VinceGledhill Posted April 3, 2011 Author Share Posted April 3, 2011 I have taken someone else's form and modified it for my purposes. Please can someone tell me how to take the information that the user enters, then submit it into the database, then get that information and put it into the card and show it on screen. Here is the code from my modified input form. <html> <body> <table width="544" border="0" align="center" cellpadding="1" cellspacing="1" class="tbl_border"> <tr> <td width="540"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="tbl_grey_wborder"> <tr> <td class="txt14b_red"><table width="479" border="0" align="center" cellpadding="0" cellspacing="0" class="txt12b_black"> <tr> <td width="8"></td> <td width="152"></td> <td width="281"></td> <td width="38"></td> </tr> <tr> <td colspan="4" class="txt24b_black"><p>Airfield Submission</p> <p> </p></td> </tr> <tr> <td colspan="4" align="center"><?php echo $error; ?> <div align="left"></div></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Your Name:</div></td> <td height="26" align="right" class="txt_main12"><input name="username" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['username'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Airfield Name:</div></td> <td height="26" align="right" class="txt_main12"><input name="airfieldname" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['airfieldname'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Height Above Sea:</div></td> <td height="26" align="right" class="txt_main12"><input name="heightabovesea" type="int" class="form-field-white-nar-sm" value="<?php echo $_SESSION['heightabovesea'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">General Location:</div></td> <td height="26" align="right" class="txt_main12"><input name="generallocation" type="text" class="form-field-white-nar-sm" value="<?php echo $_SESSION['generallocation'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Co-Ordinates:</div></td> <td height="26" align="right" class="txt_main12"><input name="co_ords" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['co_ords'] ?>" size="30" maxlength="20" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">PPR Required?:</div></td> <td height="26" align="right" class="txt_main12"><input name="ppr" type="bool" class="form-field-white-nar-sm" value="<?php echo $_SESSION['ppr'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Alternate Airfield:</div></td> <td height="26" align="right" class="txt_main12"><input name="alternate" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['alternate'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Air Ground Radio:</div></td> <td height="26" align="right" class="txt_main12"><input name="airground" type="bool" class="form-field-white-nar-sm" value="<?php echo $_SESSION['airground'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Radio Frequency:</div></td> <td height="26" align="right" class="txt_main12"><input name="radiofrequency" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['radiofrequency'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Runways:</div></td> <td height="26" align="right" class="txt_main12"><input name="radiofrequency" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['radiofrequency'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Circuits:</div></td> <td height="26" align="right" class="txt_main12"><input name="circuits" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['circuits'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Remarks:</div></td> <td height="26" align="right" class="txt_main12"><input name="remarks" type="text" class="form-field-white-nar-sm" value="<?php echo $_SESSION['remarks'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Warnings:</div></td> <td height="26" align="right" class="txt_main12"><input name="warnings" type="text" class="form-field-white-nar-sm" value="<?php echo $_SESSION['warnings'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Operating Hours:</div></td> <td height="26" align="right" class="txt_main12"><input name="ophours" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['ophours'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Contacts:</div></td> <td height="26" align="right" class="txt_main12"><input name="contacts" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['contacts'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="20"> <td height="26"> </td> <td height="26" class="txt12_black"><div align="left">Landing Fee:</div></td> <td height="26" align="right" class="txt_main12"><input name="landingfee" type="varchar" class="form-field-white-nar-sm" value="<?php echo $_SESSION['landingfee'] ?>" size="30" maxlength="50" /></td> <td height="26"><font class="text-required-orng"> <img src="images/required_field.gif" width="8" height="9" hspace="0" vspace="0" border="0" align="top" /></font></td> </tr> <tr height="10"> <td height="10"><img src="web_forms/images/bgcolor_pixel.gif" width="1" height="1" /></td> <td height="10" colspan="2" align="right"><img src="web_forms/images/bgcolor_pixel.gif" width="1" height="1" /></td> <td height="10"><img src="web_forms/images/bgcolor_pixel.gif" width="1" height="1" /></td> </tr> <tr height="35"> <td height="35"> </td> <td height="35" colspan="2" align="right" valign="bottom" class="txt_main_str12"> <input type="button" name="Reset" value="Check Airfield Card" onclick="ShowCard();"> <input type="button" name="Submit" value="Submit Airfield Card" onclick="SubmitForm(); return false;" ></td><td height="35"> </td> </tr> <tr height="15"> <td height="25"> </td> <td height="25" colspan="2" align="right"> </td> <td height="25"> </td> </tr> </table></td> </tr> </table></td> </tr> </table> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><br> </p> </div> </form> </div> </body> </html> Holy CODE tags! Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196268 Share on other sites More sharing options...
nomadsoul Posted April 4, 2011 Share Posted April 4, 2011 Hi Vince, That is the output form. I think you are getting a lot of good help here and you should try it all but i think you are probably getting confused by looking at all the spaghetti code in the joomla. And maybe you don't understand what everyone is saying because as you say ; you are very new to this. Here is an input form, please check that the input names match your db column names. For example where you see: <input type="text" name="id" class='text_box'> -the "id" should match that column in your table and so on with the rest of the columns. Notice the opening form tag where it says: action="process.php" The process.php will be the script that inserts this form into the database. And when you click the submit button, this form will be sent to the process.php form. I am working on that one now. As soon as the data is inserting successfully into the table, then it will be time for the display script. Make sure to test any scripts I (or anyone) sends you before applying them to your website. I'd hate for my stuff to crash your aviation website. Pun intended. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <style type='text/css'> body{ margin-left: 18px; margin-top: 18px; } body{ font-family : Verdana, Arial, Helvetica, sans-serif; font-size : 13px; color : #474747; background-color: transparent; } select, option{ font-size:13px; } ol.phpfmg_form{ list-style-type:none; padding:0px; margin:0px; } ol.phpfmg_form li{ margin-bottom:5px; clear:both; display:block; overflow:hidden; width: 100% } .form_field, .form_required{ font-weight : bold; } .form_required{ color:red; margin-right:8px; } .field_block_over{ } .form_submit_block{ padding-top: 3px; } .text_box, .text_area, .text_select { width:300px; } .text_area{ height:80px; } .form_error_title{ font-weight: bold; color: red; } .form_error{ background-color: #F4F6E5; border: 1px dashed #ff0000; padding: 10px; margin-bottom: 10px; } .form_error_highlight{ background-color: #F4F6E5; border-bottom: 1px dashed #ff0000; } div.instruction_error{ color: red; font-weight:bold; } hr.sectionbreak{ height:1px; color: #ccc; } #one_entry_msg{ background-color: #F4F6E5; border: 1px dashed #ff0000; padding: 10px; margin-bottom: 10px; } </style> <div class='form_description'> </div> <form name="flying" action='process.php' method='post' enctype='multipart/form-data' onsubmit='return fmgHandler.onsubmit(this);'> <input type='hidden' name='formmail_submit' value='Y'> <div id='err_required' class="form_error" style='display:none;'> <label class='form_error_title'>Please check the required fields</label> </div> <ol class='phpfmg_form' > <li class='field_block' id='field_0_div'><div class='col_label'> <label class='form_field'>id</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="id" class='text_box'> <div id='field_0_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_1_div'><div class='col_label'> <label class='form_field'>status</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="status" class='text_box'> <div id='field_1_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_2_div'><div class='col_label'> <label class='form_field'>username</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="username" id="field_2" value="" class='text_box'> <div id='field_2_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_2_div'><div class='col_label'> <label class='form_field'>Airfield Name</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="airfieldname" class='text_box'> <div id='field_2_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_3_div'><div class='col_label'> <label class='form_field'>Height Above Sea Level</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="heightabovesealevel" class='text_box'> <div id='field_3_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_4_div'><div class='col_label'> <label class='form_field'>General Location</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="field_4" id="generallocation" rows=4 cols=25 class='text_area'></textarea> <div id='field_4_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_5_div'><div class='col_label'> <label class='form_field'>Co-ordinates</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="co_ordinates" class='text_box'> <div id='field_5_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_6_div'><div class='col_label'> <label class='form_field'>Prior Permission Required</label> <label class='form_required' > </label> </div> <div class='col_field'> <select name='ppr' class='text_select' > <option value="yes" >yes</option> <option value="no" >no</option> </select> <div id='field_6_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_7_div'><div class='col_label'> <label class='form_field'>Alternative Field</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="alternate id="field_7" value="" class='text_box'> <div id='field_7_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_8_div'><div class='col_label'> <label class='form_field'>Air Ground Radio</label> <label class='form_required' > </label> </div> <div class='col_field'> <select name='airground' class='text_select'width = 20pt> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> <div id='field_8_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_9_div'><div class='col_label'> <label class='form_field'>Radio Frequency</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="radiofrequency" class='text_box'> <div id='field_9_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_10_div'><div class='col_label'> <label class='form_field'>Runways</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="runways" rows=4 cols=25 class='text_area'></textarea> <div id='field_10_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_11_div'><div class='col_label'> <label class='form_field'>Circuits</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="circuits" rows=4 cols=25 class='text_area'></textarea> <div id='field_11_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_12_div'><div class='col_label'> <label class='form_field'>Remarks</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="remarks" rows=4 cols=25 class='text_area'></textarea> <div id='field_12_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_13_div'><div class='col_label'> <label class='form_field'>Warnings</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="field_13" id="field_13" rows=4 cols=25 class='text_area'></textarea> <div id='field_13_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_14_div'><div class='col_label'> <label class='form_field'>Operating Hours</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="ophours" value="" class='text_box'> <div id='field_14_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_15_div'><div class='col_label'> <label class='form_field'>Contacts</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="contacts" rows=4 cols=25 class='text_area'></textarea> <div id='field_15_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_16_div'><div class='col_label'> <label class='form_field'>Landing Fee</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="landingfee" id="field_16" value="" class='text_box'> <div id='field_16_tip' class='instruction'></div> </div> </li> <br><input type="submit" value="Submit"> </form> </body> </html> It is a simple form but you can "fancy it up" with dreamweaver or whatever. Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196438 Share on other sites More sharing options...
VinceGledhill Posted April 4, 2011 Author Share Posted April 4, 2011 Brilliant, thanks for that nomadsoul, I would be lost without you. I have taken your form and put a table below it. Please could you "cut" your first field and show me what I need to "paste" into the table to make the form fit my table format? This tabular design would fit better onto my website. Once you have shown me what to "cut" and paste by doing the first one, I'll do the rest. I was very doubtful at first if I would ever be able to get this done, but with your help I really am starting to believe it. Thanks again for all your help. <!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>Untitled Document</title> </head> <body> <style type='text/css'> body{ margin-left: 18px; margin-top: 18px; } body{ font-family : Verdana, Arial, Helvetica, sans-serif; font-size : 13px; color : #474747; background-color: transparent; } select, option{ font-size:13px; } ol.phpfmg_form{ list-style-type:none; padding:0px; margin:0px; } ol.phpfmg_form li{ margin-bottom:5px; clear:both; display:block; overflow:hidden; width: 100% } .form_field, .form_required{ font-weight : bold; } .form_required{ color:red; margin-right:8px; } .field_block_over{ } .form_submit_block{ padding-top: 3px; } .text_box, .text_area, .text_select { width:300px; } .text_area{ height:80px; } .form_error_title{ font-weight: bold; color: red; } .form_error{ background-color: #F4F6E5; border: 1px dashed #ff0000; padding: 10px; margin-bottom: 10px; } .form_error_highlight{ background-color: #F4F6E5; border-bottom: 1px dashed #ff0000; } div.instruction_error{ color: red; font-weight:bold; } hr.sectionbreak{ height:1px; color: #ccc; } #one_entry_msg{ background-color: #F4F6E5; border: 1px dashed #ff0000; padding: 10px; margin-bottom: 10px; } </style> <div class='form_description'> </div> <form name="flying" action='process.php' method='post' enctype='multipart/form-data' onsubmit='return fmgHandler.onsubmit(this);'> <input type='hidden' name='formmail_submit' value='Y'> <div id='err_required' class="form_error" style='display:none;'> <label class='form_error_title'>Please check the required fields</label> </div> <ol class='phpfmg_form' > <li class='field_block' id='field_0_div'><div class='col_label'> <label class='form_field'>id</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="id" class='text_box'> <div id='field_0_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_1_div'><div class='col_label'> <label class='form_field'>status</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="status" class='text_box'> <div id='field_1_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_2_div'><div class='col_label'> <label class='form_field'>username</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="username" id="field_2" value="" class='text_box'> <div id='field_2_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_2_div'><div class='col_label'> <label class='form_field'>Airfield Name</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="airfieldname" class='text_box'> <div id='field_2_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_3_div'><div class='col_label'> <label class='form_field'>Height Above Sea Level</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="heightabovesealevel" class='text_box'> <div id='field_3_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_4_div'><div class='col_label'> <label class='form_field'>General Location</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="field_4" id="generallocation" rows=4 cols=25 class='text_area'></textarea> <div id='field_4_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_5_div'><div class='col_label'> <label class='form_field'>Co-ordinates</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="co_ordinates" class='text_box'> <div id='field_5_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_6_div'><div class='col_label'> <label class='form_field'>Prior Permission Required</label> <label class='form_required' > </label> </div> <div class='col_field'> <select name='ppr' class='text_select' > <option value="yes" >yes</option> <option value="no" >no</option> </select> <div id='field_6_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_7_div'><div class='col_label'> <label class='form_field'>Alternative Field</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="alternate id="field_7" value="" class='text_box'> <div id='field_7_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_8_div'><div class='col_label'> <label class='form_field'>Air Ground Radio</label> <label class='form_required' > </label> </div> <div class='col_field'> <select name='airground' class='text_select'width = 20pt> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> <div id='field_8_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_9_div'><div class='col_label'> <label class='form_field'>Radio Frequency</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="radiofrequency" class='text_box'> <div id='field_9_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_10_div'><div class='col_label'> <label class='form_field'>Runways</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="runways" rows=4 cols=25 class='text_area'></textarea> <div id='field_10_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_11_div'><div class='col_label'> <label class='form_field'>Circuits</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="circuits" rows=4 cols=25 class='text_area'></textarea> <div id='field_11_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_12_div'><div class='col_label'> <label class='form_field'>Remarks</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="remarks" rows=4 cols=25 class='text_area'></textarea> <div id='field_12_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_13_div'><div class='col_label'> <label class='form_field'>Warnings</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="field_13" id="field_13" rows=4 cols=25 class='text_area'></textarea> <div id='field_13_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_14_div'><div class='col_label'> <label class='form_field'>Operating Hours</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="ophours" value="" class='text_box'> <div id='field_14_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_15_div'><div class='col_label'> <label class='form_field'>Contacts</label> <label class='form_required' > </label> </div> <div class='col_field'> <textarea name="contacts" rows=4 cols=25 class='text_area'></textarea> <div id='field_15_tip' class='instruction'></div> </div> </li> <li class='field_block' id='field_16_div'><div class='col_label'> <label class='form_field'>Landing Fee</label> <label class='form_required' > </label> </div> <div class='col_field'> <input type="text" name="landingfee" id="field_16" value="" class='text_box'> <div id='field_16_tip' class='instruction'></div> </div> </li> <br><input type="submit" value="Submit"> </form> <table width="600" border="0" cellspacing="5" cellpadding="5"> <tr> <td width="50"> </td> <td width="250">I.D. (should this be hidden?)</td> <td width="250">Input Box</td> <td width="50"> </td> </tr> <tr> <td> </td> <td>Status (should this be hidden?)</td> <td>Input Box</td> <td> </td> </tr> <tr> <td> </td> <td>Username</td> <td>Input Box</td> <td> </td> </tr> <tr> <td> </td> <td>Airfield Name</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td>Height Above Sea Level</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td>General Location</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td>CoOrdinates</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td>Prior Permission Required</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/232380-how-do-i-take-input-and-put-it-into-a-table/#findComment-1196493 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.