Web Analytics Made Easy -
StatCounter Query String - CodingForum

Announcement

Collapse
No announcement yet.

Query String

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Query String

    Hi guys

    Is it possible that you could send multiple values in one query string value like

    <a href somepage.php?category=style,art,music>Add</a>

    or

    Or could we send an array like

    $category = array("style","art","music");

    <a href somepage.php?category=$category>Add</a>

    Is this possible or am i totally out of track,or is there anyway of doing it
    Great people talk about ideas.Average people talk about things.Small people talk about other people And [email protected] legends, like us, never talk...we just drink

  • #2
    <a href somepage.php?category=style,art,music>Add</a>

    What is the reason for sending three categories like that?

    You could just do this:
    <a href 'somepage.php?category=1'>Add</a>

    Then, inside the script, somepage.php, you look at the value of "category"
    and make decisions based on the value.

    But to answer your question, yes, it works fine.
    Within the script, somepage.php, you would bring in the variable,
    $category=$_REQUEST['category'];

    and then the variable $category would be "style,art,music" (with commas).

    You can split the variable by commas later on.

    Comment


    • #3
      don't forget to test to see if the POST is actually an array or you'll get fun errors

      Comment

      Working...
      X