I know how to it with text inputs. I can easily put a php script in its value, but doing it with input groups seems different. How can I mantain the values of group inputs if the submission of the form fails?
Share
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.
To re-mark a checkbox or radio button as checked, you use this code:
The key is
checked="checked".If you are using groups of checkboxes, make sure the
nameof the field ends with brackets[], like this:Then your
$_REQUEST['foo']variable will automatically be an array of checked values. You can usein_arrayto see if a particular checkbox was checked.Update based on comment
Here’s how I would set it:
For single items (like radios), use this:
Hope that helps.
Update 2:
Also, make sure you escape user input! Your example should look like this:
Always assume the user is trying to hack your system, always escape user input!