Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Thanked 0 Times in 0 Posts

    Want to send multiple selects as one input.

    I have two drop down menus that each have different things in them. I choose both of them. When I submit "x" in one menu and "y" in another I want it to work so that the url will be

    How would I go about doing this?

    I tried doing this but it didn't work:
    <?php $key=""; ?>
    function h(dd) 
    	var idx = dd.selectedIndex;
      var val = dd[idx].label;
    	return "\"" + val + "\"";
      	<td span="2">
        	<form action="<?php echo $mm_action_url."index.php" ?>" method="get">
          	<select name="keyword" onChange="h(this);">
    					<option label="Select Car">Select Car</option>
    					<option label="אאודי">אאודי</option>
            <input class="button" type="submit" name="Search" value="<?php echo $VM_LANG->_('PHPSHOP_SEARCH_TITLE') ?>" />
            <input type="hidden" name="keyword" value="<?php echo $key;?>" />
    				<input type="hidden" name="Itemid" value="<?php echo intval(@$_REQUEST['Itemid']) ?>" />
    				<input type="hidden" name="option" value="com_virtuemart" />
    				<input type="hidden" name="page" value="shop.browse" />

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,573 Times in 2,551 Posts
    Hopefully this should move you forward:-

    <form name = "myform">
    <select name = "sel1" id = "sel1" onchange = "getValue()">
    <option value = "a">a</option>
    <option value = "b">b</option>
    <option value = "c">c</option>
    <select name = "sel2" id = "sel2" onchange = "getValue()">
    <option value = "x">x</option>
    <option value = "y">y</option>
    <option value = "z">z</option>
    <script type = "text/javascript">
    function getValue() {
    var obj1 = document.getElementById("sel1");
    var p1 = obj1.value;
    var obj2 = document.getElementById("sel2");
    var p2 = obj2.value;
    var keyword = p1 + "+" + p2;
    alert (keyword);

    Before a man speaks it is safe to assume that he is a fool. After he speaks it is seldom necessary to assume.
    H.L. Mencken 1880-1956, American Editor, Author, Critic, Humorist


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts