Page 1 of 1

Help with <select option> adding more values..

Posted: Sat Nov 28, 2009 3:47 am
by ibom
Can someone tell me how to add more values like "currency" when country is selected. the currency is auto insert in to the table currency.
EX. selecting USA -> USA, the country is insert into country table, and USD is insert into currency table....

Code: Select all

 
[color=#BF4080]Country: 
          <select name="country" id="select8">
            <option value="USA">USA</option>
            <option value="UK">UK</option>
            <option value="Egypt">Egypt</option>
            <option value="Jordan">Jordan</option>
            <option value="Kuwait">Kuwait</option>
            <option value="Lebanon">Lebanon</option>
            <option value="Libya">Libya</option>
            <option value="Marocco">Marocco</option>
            <option value="Oman">Oman</option>
            <option value="Qatar">Qatar</option>
            <option value="Saudi Arabia">Saudi Arabia</option>
            <option value="Syria">Syria</option>
            <option value="Tunisia">Tunisia</option>
            <option value="Turkey">Turkey</option>
            <option value="UAE">UAE</option>
            <option value="Yemen">Yemen</option>
            </select>[/[/color]code]

Re: Help with <select option> adding more values..

Posted: Sat Nov 28, 2009 4:14 am
by dheeraj
just place one more value with the country name, separated by comma e.g.,

<option value="USA, Dollar">USA</option>
at the time of submission explode the selected value using explode method like

$con = explode(",", $_POST['xyz'])

so the result will be
$con[0] = "USA" * $con[1] = "Dollar"..

Re: Help with <select option> adding more values..

Posted: Sat Nov 28, 2009 8:33 am
by ibom
Hey agian

I'm using this type of connection.:

Code: Select all

 
 
mysql_query("INSERT INTO users
                  (`user_email`,`user_pwd`,`country`,`currency`,`transacc`,`joined`,`activation_code`,`full_name`,`Website`)
                  VALUES
                  ('$_POST[email]','$md5pass','$_POST[country]','$_POST[currency]','$_POST[transacc]',now(),'$activ_code','$_POST[full_name]','$_POST[Website]')") or die(mysql_error());
 
 
What is xzy.. Sorry i'm new at this php...