Page 1 of 1
Preventing form items from being sent to the server
Posted: Sat Oct 03, 2009 2:55 pm
by enchance
Usually, when clicking on a 'submit' button, the form sends all the 'value' attributes within the form to the server. But is there a way to
not send the 'value' attribute of form elements which are invisible (style="display:none")?

Re: Preventing form items from being sent to the server
Posted: Sat Oct 03, 2009 3:16 pm
by requinix
You could use JavaScript to actually remove the elements from the form.
But otherwise no. Can't you just ignore them?
Re: Preventing form items from being sent to the server
Posted: Sat Oct 03, 2009 10:37 pm
by enchance
I got it and the answers pretty simple too! Just add disabled="disabled" to the item and it won't be sent along with $_POST. How ironic that I was thinking of using AJAX or PHP when HTML could already do the trick for me. This proves that the right answer we're looking for is sometimes just under our noses.
