Jump to content

PHP Contact Us code ~ Help


kopykakemg

Recommended Posts

Hello All,

Not sure if this is the right place but here's what I would like to do. I have a very simple contact us page for our company in our XCART. Today I got the request to change a few things but I'm not really a huge PHP developer (I code in C#). So my question is the following, when my users are filling out the form it also asks for country. If the country is NOT Equal to US (United States) then just show the country from the drop down list. But IF the country eq 'US' then I want the State Drop-down to show. How could I make this Happen? It appears that I need to somehow combine theses two methods together with a If/Else if?? Below is the actual code un-touched:

{if $default_fields.b_country.avail eq 'Y'}
<tr>
<td class="data-name"><label for="b_country">{$lng.lbl_country}</label></td>
<td{if $default_fields.b_country.required eq 'Y'} class="data-required">*{else}> {/if}</td>
<td>
<select id="b_country" name="b_country" onchange="javascript: check_zip_code_field(this, $('#b_zipcode'));">
{foreach from=$countries item=c}
<option value="{$c.country_code}"{if ($userinfo.b_country eq $c.country_code) or ($c.country_code eq $config.General.default_country and $userinfo.b_country eq "")} selected="selected"{/if}>{$c.country}</option>
{/foreach}
</select>
</td>
</tr>
{/if}

{if $default_fields.b_state.avail eq 'Y'}
<tr>
<td class="data-name"><label for="b_state">{$lng.lbl_state}</label></td>
<td{if $default_fields.b_state.required eq 'Y'} class="data-required">*{else}> {/if}</td>
<td>
{include file="main/states.tpl" states=$states name="b_state" default=$userinfo.b_state|default:$config.General. default_state default_country=$userinfo.b_country|default:$confi g.General.default_country country_name="b_country"}
</td>
</tr>
{/if}

Thank you in advance,

~Mario

post-158854-0-10324100-1371503253_thumb.jpg

Link to comment
Share on other sites

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.