funbinod Posted March 2, 2014 Share Posted March 2, 2014 please help me inserting data to mysql database table from a html table. like <table> <tr> <td>name</td> <td>Gender</td> <td>age</td> <td>school</td> </tr> <tr> <td>John</td> <td>Male</td> <td>21</td> <td>Oxford</td> </tr> <tr> <td>Juliya</td> <td>Female</td> <td>25</td> <td>Oxford</td> </tr><!- bla! bla! bla! --></table>SUBMIT I want to send all the rows' data at once to a table. Please guide how could it be done! Link to comment Share on other sites More sharing options...
dsonesuk Posted March 2, 2014 Share Posted March 2, 2014 You can't! the data must be entered by form inputs, when the form is submitted it will in most cases go to a page, that connects to a database through validation of host, username, password to insert the imputed details to specific table and column names. Link to comment Share on other sites More sharing options...
niche Posted March 2, 2014 Share Posted March 2, 2014 http://www.w3schools.com/php/php_mysql_intro.asp will get you started. Link to comment Share on other sites More sharing options...
funbinod Posted March 3, 2014 Author Share Posted March 3, 2014 (edited) You can't! the data must be entered by form inputs, when the form is submitted it will in most cases go to a page, that connects to a database through validation of host, username, password to insert the imputed details to specific table and column names. thank u. can't the table be treated as form!? i mean all are coded in FORM but displayed as TABLE! if not could we MOVE all data from a database table to another and delete it with a single SUBMIT!? Edited March 3, 2014 by funbinod Link to comment Share on other sites More sharing options...
birbal Posted March 3, 2014 Share Posted March 3, 2014 You can format the form so it looks like table. you can use 'box modeling' in css to achieve it. Google box modeling for more information. Link to comment Share on other sites More sharing options...
funbinod Posted March 3, 2014 Author Share Posted March 3, 2014 You can format the form so it looks like table. you can use 'box modeling' in css to achieve it. Google box modeling for more information. sorry sorry! i think i wrote wrong. i wish a TABLE be treated as FORM, not FORM as TABLE. and more important is "MOVE EVERY DATA FROM A DATABASE TABLE TO ANOTHER AND DELETE IT WITH A SINGLE SUBMIT". can u please help me with this...??? Link to comment Share on other sites More sharing options...
birbal Posted March 3, 2014 Share Posted March 3, 2014 (edited) I am not sure but probably it will have validation error if you put table tag inside form tag. The second option will be better. and more important is "MOVE EVERY DATA FROM A DATABASE TABLE TO ANOTHER AND DELETE IT WITH A SINGLE SUBMIT". can u please help me with this...??? You can use INSERT INTO tablename SELECT * FROM tabletwo (check the manual of mysql) variation to select all column from table and insert it into another. and then use DELETE query to delete it from the first table. you can also use transaction to make it synced. Edited March 3, 2014 by birbal Link to comment Share on other sites More sharing options...
justsomeguy Posted March 3, 2014 Share Posted March 3, 2014 Forms are how you get data from a browser to a server. You can write some Javascript code to convert an entire table to a form structure if you really want to do that, but at the end of the day you're going to be submitting a form. The browser doesn't have any behavior to "submit" a table, that's not how tables are defined in HTML. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now