Title: Search form code
Last modified: August 21, 2016

---

# Search form code

 *  Resolved [Helpful Guy Uk](https://wordpress.org/support/users/helpful-guy-uk/)
 * (@helpful-guy-uk)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/search-form-code/)
 * Hi,
 * Im trying to make a Combo box search for Woocommerce but i cant figure out how
   to make get the results from the combo to generate a product search:
 * Basically I want to get the item to search for the chosen selection, for example
   if “coke” was the chosen i then want to search for “coke” as a woocommerce product.
   i need to know how to code it where the stars are.
 * Code example:
 *     ```
       <script type="text/javascript">
       function populate(s1,s2){
       	var s1 = document.getElementById(s1);
       	var s2 = document.getElementById(s2);
       	s2.innerHTML = "";
       	if(s1.value == "drink"){
       		var optionArray = ["|","coke|Coke","orange|Orange"];
       	} else if(s1.value == "food"){
       		var optionArray = ["|","pie|Pie"];
       	}
       	for(var option in optionArray){
       		var pair = optionArray[option].split("|");
       		var newOption = document.createElement("option");
       		newOption.value = pair[0];
       		newOption.innerHTML = pair[1];
       		s2.options.add(newOption);
       	}
   
       <script type="text/javascript">
       function results(s1,s2){
       	var s1 = document.getElementById(s1);
       	var s2 = document.getElementById(s2);
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_
 *  **********************************
 * [http://wordpress.org/plugins/woocommerce/](http://wordpress.org/plugins/woocommerce/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [Helpful Guy Uk](https://wordpress.org/support/users/helpful-guy-uk/)
 * (@helpful-guy-uk)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/search-form-code/#post-4383018)
 * Dont now why i ask this question as the search form information should be sent
   client side.

Viewing 1 replies (of 1 total)

The topic ‘Search form code’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)

 * 1 reply
 * 1 participant
 * Last reply from: [Helpful Guy Uk](https://wordpress.org/support/users/helpful-guy-uk/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/search-form-code/#post-4383018)
 * Status: resolved