i added another dropdown to the form,
tpl file
headerPHP Code:zen_get_country_list('country', $country, 'id="country")
i get "223" in emailPHP Code:$my_email_text = $ecountry;
what do i get the text "United States" instead of the id "252" ?
i added another dropdown to the form,
tpl file
headerPHP Code:zen_get_country_list('country', $country, 'id="country")
i get "223" in emailPHP Code:$my_email_text = $ecountry;
what do i get the text "United States" instead of the id "252" ?
What is defining $pulldown? $pulldown and $pulldown_array aren't the same variables.
You're collecting the displayed email data through a $_POST from the form. The value submitted through the form is "1", which is the key of the menu array, whereas "Option A" is the value of that key.
Without seeing how you've set up $pulldown, you might try something like:
And so on.PHP Code:if ($_POST['pulldown'] == '1') {
$email_display = 'Option A';
} elseif ($_POST['pulldown'] == '2') {
$email_display = 'Option B';
}
[FONT="Verdana"]If you want something done right, you have to get Zenned.
♥~-My Zen Cart Mods-~♥[/FONT]
thanks for your help, my pulldown finally works correctly
but i'm not sure what do i make my country list pulldown display country name instead of country id
there are hundreds of countries, do i have to add the code below?
if ($_POST['country'] == '223') {
$email_display = 'United States';
} elseif ($_POST['country'] == '38') {
$email_display = 'Canada';
}
...
There's already a built-in function to prepare the list of countries for a pulldown, as well as built-in logic for reading the value out and matching it with its corresponding name from the database. You'll find that logic in the sections of code that deal with address book handling and account creation.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Again, without seeing how you're creating the email display, I would suggest trying to target the array value instead of the key.
Maybe something like:
Hope this helps. :)PHP Code:foreach ($country_id as $id=>$country) {
$email_display = $country;
}
Last edited by ToniScraparoni; 16 May 2011 at 02:14 AM. Reason: Extra post - walked away and left my window open, didn't see DrB had replied. His answer is better, of course! :)
[FONT="Verdana"]If you want something done right, you have to get Zenned.
♥~-My Zen Cart Mods-~♥[/FONT]