Hello there,
I am trying to get a dropdown form to work in my php template file. I have the form with the options working appropriatly.
<!--Apparel DropDown-->
<p>Select Style:</p>
<form name="apparel">
<p align="center">
<select name="menu">
<option selected>Choose Style:</option>
<option value="<?php get_custom_field('buy_now1', TRUE); ?>">Standard</option>
<option value="<?php get_custom_field('buy_now2', TRUE); ?>">American Apparel | +$3</option>
<option value="<?php get_custom_field('buy_now3', TRUE); ?>">Standard Long-Sleeve | +$4</option>
<option value="<?php get_custom_field('buy_now4', TRUE); ?>">Women's T-Shirt</option>
<option value="<?php get_custom_field('buy_now5', TRUE); ?>">Kid's T-Shirt</option>
<option value="<?php get_custom_field('buy_now6', TRUE); ?>">Kid's Long-Sleeve | +$2</option>
</select>
<input type="button" onClick="location=document.apparel.menu.options[document.apparel.menu.selectedIndex].value;" value="GO">
</p>
</form>
<!--end Apparel Dropdown-->
Now that code as I mentioned works. I add URLs into the custom fields into wordpres; buy_now1, buy_now2, etc. However that’s not the issue. My template file has these lines of code following the form code above:
<input type="hidden" id="amount" name="amount" value="<?php echo $value[0];?>"/>
<input type="hidden" name="buy_now" value="<?php get_custom_field('buy_now', TRUE); ?>" />
<input type="hidden" name="currency_code" value="<?php echo $OPTION['wps_currency_code']; ?>" />
<?php
//has the user remembered to use the image_thumb custom field?
if(strlen(get_custom_field('image_thumb', FALSE))>0) { ?>
<input type="hidden" name="image_thumb" value="<?php get_custom_field('image_thumb', TRUE); ?>" />
<?php }
//he did!?
else {
// get attachment
$image_thumb = my_attachment_image(0, 'full', 'alt="' . $post->post_title . '"','return');
?>
<input type="hidden" name="image_thumb" value="<?php echo $image_thumb[img_path]; ?>" />
<?php } ?>
<input type="hidden" name="add" value="1" />
<div class="shopform_btn buy_now">
<a href="<?php get_custom_field('buy_now', TRUE); ?>" <?php if($OPTION['wps_affili_newTab']) { ?> title="<?php _e('Opens is new tab','wpShop'); ?>" target="_blank"<?php } ?>><?php _e('Buy Now','wpShop'); ?></a>
</div>
What I need to have happen is get the dropdown “GO” button to work as the new a href under div “shopform_btn buy_now”. Basically depending on what is selected in the dropdown, the buy_now button changes to that URL. I have tried to replace <a href=“<?php get_custom_field(‘buy_now’, TRUE); ?>” with <a onClick=“location=document.apparel.menu.options[document.apparel.menu.selectedIndex].value;” However that did not work, it just got me my 404 error page.
Does that make sense? Please ask if I can help explain.
I really appreciate any help on this matter.
Lorne