>From the page where I allow multiple keyword submissions:

                echo "<SELECT MULTIPLE SIZE=10 name=keyword[] class=select>\n";

                $sql->Query("SELECT idKeyword AS idKeyword, keyword AS keyword FROM
Keyword WHERE (keyword <> '') ORDER BY keyword");
                $rowcount = $sql->rows;
                for ($i=0; $i < $rowcount; $i++) {
                        $sql->Fetch($i);
                        $thumbkeyword = $sql->data["keyword"];
                        $thumbkeywordUpper = ucwords($sql->data["keyword"]);
                        echo "<option value=\"$thumbkeyword\">$thumbkeywordUpper\n";
                        }
                echo "</SELECT><BR /><BR />\n";



// NOTE THE name=keyword[] in the SELECT line

The page that retrieves the values:

        $keyword = $_POST["keyword"];

        if(is_array($keyword))
                {
                        for($i=0; $i<count($keyword); $i++)
                        {
                                SQL COMMAND here
                        }
                }

Hope this helps.

Thanks,

John Ellingsworth
http://ellingsworth.org/john/

-----Original Message-----
From: Fernando Soto [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2003 11:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] help with multiple select


Hello there....

I'm trying to get the options selected from a multiple select list, but the
only one thing that i get is the first letter from one element, check this
please....

This is the form code.

<form name="form1" method="post" action="checaMultiple.php">
  <p>
    <select name="Multiplo" multiple size="3">
      <option value="Fernando">Fernando</option>
      <option value="Felipe">Felipe</option>
      <option value="Felix">Felix</option>
      <option value="Carlos">Carlos</option>
      <option value="Eli">Eli</option>
    </select>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>

and this is the code where i try to get the options selected

$multiplo = $_POST['Multiplo'];
echo "Cuantos seleccionados: " . count($multiplo);   // In this line I
always get 1
$j = 0;
while($j<count($multiplo)){
     echo "No: " . $j . ", " . $multiplo[$j];
     $j++;
}

If I select only one element, i get the first letter of that element, but if
I select two or more elements i get the first letter of the last element
selected.

Can somebody tell me what's wrong?

Thanks in advance..
eLFeR....



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to