php - How to send the user to a new URL? -


this current url.

i've had new project time , wondering if:

  1. there way when user clicks gadgets sends him .... cat=gadgets, , remembers previous selections
  2. how can transform awful looking dropdown list more appealing radio or 2 basic buttons.

my code:

<div id="advanced-search">     <form action="<?php bloginfo('url');?>/recipes" method="get" id="searchf1">         <?php         $searched_term = get_query_var('recipe_search');         if (empty($searched_term)) {             $searched_term = isset($_get["search"]) ? $_get["search"] : "";         }         ?>         <input id="sfield" type="text" name="search" placeholder="keywords" <?php if (!empty($searched_term)) {echo 'value="'.$searched_term.'"';} ?>>         <select id="img" name="images">             <option value="1" <?php if($_get["images"]=='1'){ echo 'selected="selected"';} ?>>with pictures</option>             <option value="0" <?php if($_get["images"]=='0'){ echo 'selected="selected"';} ?>>without pictures</option>         </select>         <div id="time-side">             <!--<small>published time</small>-->             <input type="text" id="from-side" name="from" placeholder="start date">             <input type="text" id="to-side" name="to" placeholder="end date">         </div>         <input type="submit" value="tech">         <input type="submit" value="gadgets">     </form> </div> 

you can save data on multiple pages in few different ways.

  1. url: can transfer data through url's, this: example.com/index.php?id=12345 can id through $_get, $_get['id']
  2. session can save value in session, best option saving of previous data. can save value this: $_session["key"] = "value"; can acces value anywhere on website this: $_session["key"]. nice , simple.

  3. cookies can store cookie can $_session it's saved on users computer long want. please read manual if want use it.

so in case, can send catagory information through url. this: example.com/file.php?catagory=toyota. data in php code can this: $_get['catagory']

the storing of data of previous section

$_session["previoussection"] = "some value"; 

you can later acces this: $_session["previoussection"] , "some value"


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -