![]() |
|
#1
|
|||
|
|||
|
How to get the input elements by basing on the formid?
Hi, may i have some idea please on how would i get input elements by just basing on form id?
In my example there are 2 forms with different form name and form id. The first one, form name and id is formm1. Second is form2. My problem is how would i get the length of dtlid[] in form1 and form2? So basically when i click submit form1 or form 2 i will get the length of form1 dtlid[] so i would know which qty textfields has a value. Any idea please, how it is done? HTML Code:
<div> <form method="post" name="formm1" id="formm1" action="#"> <input type="hidden" name="mainid" value="M01"> <input type="hidden" name="dtlid[]" value="23"><input type="text" name="qty[]"> <input type="hidden" name="dtlid[]" value="30"><input type="text" name="qty[]"> <input type="hidden" name="dtlid[]" value="31"><input type="text" name="qty[]"> <input type="submit" name="submit" value="submit"> </form> </div> <div> <form method="post" name="formm1" id="formm2" action="#"> <input type="hidden" name="mainid" value="M01"> <input type="hidden" name="dtlid[]" value="60"><input type="text" name="qty[]"> <input type="submit" name="submit" value="submit"> </form> </div> |
| Sponsored Links |
|
#2
|
|||
|
|||
|
in each form, have an extra input field
like this <input type="hidden" name="form_name" value="formm1" /> so, u would know which form is being submitted
__________________
Free webspace to test php/mysql (keep backup) MySQL Host: sql305.0lx.net >FTP Server: ftp.0lx.net >DB name: 0lx_4217081_testdb FTP/SQL User: 0lx_4217081 >FTP/SQL Password:123456 Website URL: use4free.co.cc (upload to folder "htdocs") |
|
#3
|
||||
|
||||
|
hidden inputs are bad.
javascript can change the values.
__________________
HTML,CSS,PHP,Javascript,jQuery,AJAX,mySQL and a very fast typer for Google. Just ask me. Please +rep me if I helped you. Thanks! Join my new game! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|