Skip to content

Instantly share code, notes, and snippets.

@kalinchernev
Created July 21, 2014 13:23
Show Gist options
  • Save kalinchernev/d7ccf9b784ef1c98c641 to your computer and use it in GitHub Desktop.
Save kalinchernev/d7ccf9b784ef1c98c641 to your computer and use it in GitHub Desktop.
Search form
<?php
/*
* Available variables
* $query array current query from the URL
*/
?>
<?php // dpm($query); ?>
<div id="search-products">
<h2><?php echo t("Rechercher un produit");?></h2>
<form method="GET" id="search-form" action="catalog-search">
<input type="text" id="search-term" name="keyword" placeholder="Nom ou Reference" value="<?php if ( isset($query['keyword']) ) { echo $query['keyword']; } else { echo ""; } ?>">
<input type="submit" value="Search" id="search-button">
<select id="search-category" name="category">
<option value=""><?php echo t("Search in ..."); ?></option>
<option value="equipment" <?php echo isset($_GET["category"]) && $_GET["category"] == "equipment" ? "selected" : "" ?>><?php echo t("Equipment"); ?></option>
<option value="gas" <?php echo isset($_GET["category"]) && $_GET["category"] == "gas" ? "selected" : "" ?>><?php echo t("Gas"); ?></option>
<option value="services" <?php echo isset($_GET["category"]) && $_GET["category"] == "services" ? "selected" : "" ?>><?php echo t("Services"); ?></option>
</select>
</form>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment