mardi 31 mars 2015

How To Get Value and Set Name From Dynamic Form

Maybe the title made confused. But I have a case like this,


I have a form that contains some input text (textbox). But this input is depend on my database.



<label class="strong"><?php echo $rowexp['mexpense_name']; ?></label>
<input type="text" class="span4" placeholder="Expense <?php echo $rowexp['mexpense_name']; ?>" name="" />


Here's my database for that input text:



tbl_mexpensive -> mexpensive_id, mexpensive_name
tbl_expensive -> expensive id, expensive_year
tbl_texpensive -> mexpensive_id, expensive_id


So the number of textfield will be same as much as the data at tbl_mexpensive and the POST page will set to tbl_texpensive.


For example, if mexpensive got 3 value then: [textbox1] [textbox2] [textbox3] If i click submit It return to POST page and get the value each of the textbox BUT the query is like this: insert into texpensive (exp_id, mexp_id) VALUE (exp_id, XXX)


From above, my question is, how to get the value at the POST page (XXX)? I mean, what name should I give to that input text? I have try an array but it's not work properly. I try give it name as the table value, still no result because it's a dynamic textbox.


Sorry for my bad English.


Aucun commentaire:

Enregistrer un commentaire