Forum Moderators: coopster

Message Too Old, No Replies

Need Help

How to choose multiple countries

         

angela5

7:52 pm on May 7, 2005 (gmt 0)



Hi everbody!

A script allows members to select only one “country” from drop down box. Here countries are as array (wcr):

[2][b]<select name="country" class="input">
<? $p=0;asort($wcr);reset($wcr);
while (list ($p, $val) = each ($wcr)) {
echo '<option value="'.$p.'">'.$val;
}
?>
</select>

mysql_query("INSERT INTO ".C_MYSQL_MEMBERS." VALUES (".$country.")[/2][/b]

It sends data to file memberview.php and here is code:

[2][b]<?if(!empty($i['country'])) {?>
wcr[$i['country']];?>[/2][/b]

I’m newbe in php, please suggest anyone how to change this, that member can choose multiple countries from drop down box? Maybe need some changes also in Mysql tables?

[2][b]
$sql = "CREATE TABLE ".C_MYSQL_MEMBERS." (
country tinyint unsigned NOT NULL default '0',
)";
mysql_query($sql);[/2][/b]

kazecoder

10:55 am on May 9, 2005 (gmt 0)

10+ Year Member



Actually you are on the right track but change your <select> line:

<SELECT NAME="country" class="input" multiple size="5">

That will allow you to select multiple countries.