supertrucker Posted January 12, 2007 Share Posted January 12, 2007 Maybe somebody here can give me an idea of what I am doing wrong. I have a form that posts to itself to validate. The part of the form that I'm having trouble with is this: Home<input type="checkbox" name="tags" value="home" /><br />Horoscopes<input type="checkbox" name="tags" value="horoscopes" /><br />Language<input type="checkbox" name="tags" value="languages" /><br />Law<input type="checkbox" name="tags" value="law" /><br />Local<input type="checkbox" name="tags" value="local" /><br /> The idea with having the "name" attributes the same is that when the form is validated, the selected values could be plugged into an array. My dillemma is, how do I retrieve these values into an array?? I figured I could just use this code: $tags = $_REQUEST['tags']; But it's not working, the $tags variable is only returning one of the selected values, but I can see from passed URL that all of the selected checkboxes were passed along correctly. How do I use PHP to retrieve multiple values from a POST/GET form that have the same name, as in the code up above?Thanks for your help,Supertrucker Link to comment Share on other sites More sharing options...
Lulzim Posted January 13, 2007 Share Posted January 13, 2007 change tags to tags[]like this Home<input type="checkbox" name="tags[]" value="home" /><br />Horoscopes<input type="checkbox" name="tags[]" value="horoscopes" /><br />Language<input type="checkbox" name="tags[]" value="languages" /><br />Law<input type="checkbox" name="tags[]" value="law" /><br />Local<input type="checkbox" name="tags[]" value="local" /><br /> Link to comment Share on other sites More sharing options...
supertrucker Posted January 13, 2007 Author Share Posted January 13, 2007 Thank you, that worked beautifully! Was rackin' my brains out with that one, most of the stuff I need to do I can find in the tutorials, but every so often, I work myself into a corner, and can't figure a way out!Thanks a bundle,Supertrucker Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now