![]() |
insert into db with incrimented rows in js
hi,
look at this page Add Row v2 (Javascript) you'll notice that when you click on add row javascript adds another row into the table. what im wondering is how do i insert the data into the table when more than 1 row is added? i was thinking of doing a loop but its really confusing me to how to add the data into the database. thanks |
Didn't you ask this before? I can't find the thread, but one of the ways you can do this is by inserting the data into an array.
Code:
<input type="text" id="row1" name="row[]" value="" />-m |
hi, here is the page sample im working off of.
http://www.gothostin.com/row.php can you please write a simple easy to understand php statement that shows atleast one line of cells being inserted into the db. because for some reason my head is not being able to understand how to do this. thanks. when i click on add row what i cant figure out is where do these textboxe variables going? so that i can see the textboxes names being created. |
common please cant anyone help me?
|
You're putting values inside of the brackets for your input array. You can do this, but because you want an unlimited number of potential rows, you should omit it and let the array take care of itself.
Here's a quick and dirty example of what happens with the data when you do this. On submit the script will display the $_POST array as it looks in it's entirety and also the smaller array that is created from the input fields. This should give you an idea of how to put the data where you want it, what it'll look like when it gets there, and how to then deal with it afterwards; PHP Code:
|
this is what i did but it doesnt work can you see what i did wrong?
thanks Code:
<?php |
nm, got it to works thanks!!! this is what i did with the for loop
since the array variable names index will always match the quantity array index. i did this Code:
for($a=0;$a<=count($name);$a++) { |
Change this line:
PHP Code:
Code:
$array[0] = '..';-m |
| All times are GMT. The time now is 11:54 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0