Jump to content

help: insert data from a table


Recommended Posts

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 post
Share on other sites

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 post
Share on other sites

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 by funbinod
Link to post
Share on other sites

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 post
Share on other sites

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 post
Share on other sites

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 by birbal
Link to post
Share on other sites

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...