Jump to content

Recommended Posts

I got a select box as follows

<select name="validmenu[]" class="inputbox" id="validmenu" size="3" multiple>
          <option value="*Valid*">*Valid*</option>
          <option value="Behaviour">Behaviour</option>
          <option value="Improper Abstract">Improper Abstract</option>
          <option value="Improper Route">Improper Route</option>
          <option value="Invalid STN">Invalid STN</option>
          <option value="Kudos">Kudos</option>
          <option value="Other">Other</option>
          <option value="Policy/Procedure">Policy/Procedure</option>
          <option value="Poor Ticket Creation">Poor Ticket Creation</option>
          <option value="Troubleshooting">Troubleshooting</option>
        </select>

 

Thanks to the awesome help from the people on the boards, I have it comma separated.

if (isset($_GET['validmenu'])) {
    $comma_separated = "'" . implode("','", $valid) . "'";
} else {
    $comma_separated = "'default'"; // or maybe some default value,  like "'default'"
}

 

I tried the following example I found but it didn't work.

<a href="sample2.php?<? for ($I=0, $I<count($array); $I++) echo
"array[]={$array[$I]}&"; ?>">

 

How would I use a session variable to pass the array data to another page?

First make sure you have session_start() as the first line of all pages that dealsw with sessions.

Then use the following to assign the $comma_separated variable to your session.

$_SESSION['comma_separated'] = $comma_separated;

 

Now in the next page use $_SESSION['comma_separated'] to retrieve the comma separated list.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.