• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Building a URL

I have the following form - when the user clicks submit I want to build a link and go to that page. I am not sure how to do it, can anyone help me out?

<form name="FOOD" method="post" action="">
  <p>
    <select name="SearchCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL CITIES</option>
      <option value="Airmont">Airmont</option>
      <option value="Ardsley">Ardsley</option>
      <option value="Armonk">Armonk</option>
      <option value="Baldwin Place">Baldwin Place</option>
    </select>
  </p>
  <p>
    <select name="SearchSubCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL TYPES</option>
      <option value="American">American</option>
      <option value="Bakery">Bakery</option>
      <option value="Barbecue">Barbecue</option>
      <option value="Brazilian">Brazilian</option>
    </select>  
  </p>
  <p>
    <input type="text" name="SearchKeyword" id="SearchKeyword" class="indextxt" value="" size="21" maxlength="50">
  </p>
</form>



I need the choices to that the user selects to populate the URL and go to the following page:

http://www.website.com/food.php?tab=events&query=VenueFoodFind&site=ESD&tpl=VenueFoodSearch&SearchKeyword=&SearchCategory=&SearchSubCategory=&SubmitEvent=submit

SearchKeyword= VALUE OF --->    <input type="text" name="SearchKeyword" id="SearchKeyword" class="indextxt" value="" size="21" maxlength="50">

SearchCategory = VALUE OF --->    <select name="SearchCategory" style="width: 170px" size="8" class="indextxt">

SearchSubCategory = VALUE OF ---->     <select name="SearchSubCategory" style="width: 170px" size="8" class="indextxt">
0
lvollmer
Asked:
lvollmer
  • 3
  • 2
1 Solution
 
ZvonkoSystems architectCommented:
Like this:


<form name="FOOD" method="GET" target="_self" action="http://www.website.com/food.php?tab=events&query=VenueFoodFind&site=ESD&tpl=VenueFoodSearch">
  <p>
    <select name="SearchCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL CITIES</option>
      <option value="Airmont">Airmont</option>
      <option value="Ardsley">Ardsley</option>
      <option value="Armonk">Armonk</option>
      <option value="Baldwin Place">Baldwin Place</option>
    </select>
  </p>
  <p>
    <select name="SearchSubCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL TYPES</option>
      <option value="American">American</option>
      <option value="Bakery">Bakery</option>
      <option value="Barbecue">Barbecue</option>
      <option value="Brazilian">Brazilian</option>
    </select>  
  </p>
  <p>
    <input type="text" name="SearchKeyword" id="SearchKeyword" class="indextxt" value="" size="21" maxlength="50">
  </p>
     <input type="submit" name="SubmitEvent" value="submit" >
</form>



0
 
lvollmerAuthor Commented:
I don't see where the SearchKeyword, SearchCategory, and SearchSubcategory are in that URL

IE: it the user selects a keyword of FOOD, SearchCategory = Airmont, SearchSubcategory=American

The submit button would take you to this URL


http://www.website.com/food.php?tab=events&query=VenueFoodFind&site=ESD&tpl=VenueFoodSearch&SearchKeyword=FOOD&SearchCategory=AIRMONT&SearchSubCategory=AMERICAN&SubmitEvent=submit
0
 
ZvonkoSystems architectCommented:
Sorry, better check this:



<form name="FOOD" method="GET" action="http://www.website.com/food.php">
<input type="hidden" name="tab" value="events" >
<input type="hidden" name="query" value="VenueFoodFind" >
<input type="hidden" name="site" value="ESD" >
<input type="hidden" name="tpl" value="VenueFoodSearch" >
  <p>
    <select name="SearchCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL CITIES</option>
      <option value="Airmont">Airmont</option>
      <option value="Ardsley">Ardsley</option>
      <option value="Armonk">Armonk</option>
      <option value="Baldwin Place">Baldwin Place</option>
    </select>
  </p>
  <p>
    <select name="SearchSubCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL TYPES</option>
      <option value="American">American</option>
      <option value="Bakery">Bakery</option>
      <option value="Barbecue">Barbecue</option>
      <option value="Brazilian">Brazilian</option>
    </select>  
  </p>
  <p>
    <input type="text" name="SearchKeyword" id="SearchKeyword" class="indextxt" value="" size="21" maxlength="50">
  </p>
     <input type="submit" name="SubmitEvent" value="submit" >
</form>



0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ZvonkoSystems architectCommented:
Give the last proposal a try and tell me what you get in a browser when you press submit.

0
 
lvollmerAuthor Commented:
OK
0
 
CLupoCommented:
To keep using the post and not get try this :

<script language="JavaScript">
      function buildLink()
            {
                  document.FOOD.action = 'http://www.website.com/food.php?tab=events&query=VenueFoodFind&site=ESD&tpl=VenueFoodSearch&SearchKeyword=' + document.FOOD.SearchKeyword.value + '&SearchCategory=' + document.FOOD.SearchCategory.value + '&SearchSubCategory=' + document.FOOD.SearchSubCategory.value + '&SubmitEvent=submit';
                  document.FOOD.submit();
            }
</script>

<form name="FOOD" method="post">
  <p>
    <select name="SearchCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL CITIES</option>
      <option value="Airmont">Airmont</option>
      <option value="Ardsley">Ardsley</option>
      <option value="Armonk">Armonk</option>
      <option value="Baldwin Place">Baldwin Place</option>
    </select>
  </p>
  <p>
    <select name="SearchSubCategory" style="width: 170px" size="8" class="indextxt">
      <option value="" selected>ALL TYPES</option>
      <option value="American">American</option>
      <option value="Bakery">Bakery</option>
      <option value="Barbecue">Barbecue</option>
      <option value="Brazilian">Brazilian</option>
    </select>  
  </p>
  <p>
    <input type="text" name="SearchKeyword" id="SearchKeyword" class="indextxt" value="" size="21" maxlength="50">
  </p>
  <input type="button" onclick="buildLink();">
</form>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now