Is there a way not to process fields with a “display:none” style ? The fields are dynamically hidden using javascript but are processed normally in PHP.
I’m looking for a PHP solution (no javascript).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending on how your form is structured, it might be a viable method to remove the
nameattribute of the hidden inputs. in whatever Javascript you use to hide the input, add this line:Inputs without a name are not submitted with the form. If you might need to revert back (and show the inputs again), you might want to think about storing the name somewhere retrievable: perhaps use the same
nameas theidon each element, or store it into the element’sclassattribute somewhere.A better idea, as suggested by Colin, would be to disable the element instead. This will have the same effect as removing its name, however it would be much easier to revert, should you need to.