php - getting only certain information from a form -


is there way set of information form? eg

<form> <input name='i want this' value='one' type=text /> <input name='and this' value='one' type=text /> <input name='but not this' value='one' type=text /> </form> 

where, obviously, want first 2 fields not third one? i've got user inventory on website looks this:

 <form action="" method="post"> <input name='item_id' value='1' type='hidden'> <input type='button' name='slot1' value='1'> <input type='button' name='slot2' value='2'> <input name='item_id' value='2' type='hidden'> <input type='button' name='slot1' value='1'> <input type='button' name='slot2' value='2'> </form> 

i want users able select, item 1 , equip slot 1 way can think of doing right have them separate forms. , feel bad coding.

yes, using jquery, select first element , second elements value, post using ajax, , retrieve , process data server side.

var i1 = $('form').eq(0).find('[name="item_id"]').val()  //values first form var i2 = $('form').eq(0).find('[name="slot1"]').val()  $.ajax({   url: "test.php",   data: {i1:i1, i2:i2}, //send php file.   }).done(function() {   $(this).addclass("done");   }); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -