form not handling $_GET array variable (1 post)

  1. fedantiks
    Posted 7 years ago #

    I'm new to WP and PHP so there might be a few places where this goes wrong.. but I am trying to make a form where users can check the categories of posts that they want to see, then have only the intersection of their selections listed on the next page. I seem to have this form working..

    <form action="index.php" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" method="get">
    <input name="GeoIndSpec" size="20" type="checkbox" value="24" />Michigan</br>
    <input name="GeoIndSpec" size="20" type="checkbox" value="70" />Defense</br>
    <input name="GeoIndSpec" size="20" type="checkbox" value="66" />Automotive</br>
    <input size="20" type="submit" value="Search" />

    but this only ends up putting the last item checked into the variable on the next page. I want to set "GeoIndSpec" as an array, but if I do this code

    <form action="index.php" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" method="get">
    <input name="GeoIndSpec[]" size="20" type="checkbox" value="24" />Michigan</br>
    <input name="GeoIndSpec[]" size="20" type="checkbox" value="70" />Defense</br>
    <input name="GeoIndSpec[]" size="20" type="checkbox" value="66" />Automotive</br>
    <input size="20" type="submit" value="Search" />

    the URL comes back messed up:

    I know that's the value for the left and right brackets, but I thought that's how one turned it into an array to handle multiple values? Any help would be greatly appreciated- thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic