php - Setting the name of a text-field to the option selected from a drop-down list -


             <form action="<?php echo $self ?>" method="post">                 <br>                     <select name="choice" id="choice">                           <option value="product" name="product">product</option>                                       <option value="saab">brand</option>                           <option value="mercedes">price</option>                           <option value="audi">name</option>                     </select>             <br>                    search :<input name="<?php $choice=$_post['choice'];?>" type="text" value="<?php $choice ?>"><br>                        <br><input type="submit" name="submit" value="search">             </form> 

what want value dropdown list , set value of textfield dont want use java script

i want value selected "choice" name of textarea search seen below

anyhelp apperciated thanks

$self = $_server['php_self'];     if (isset($_post['submit'])) {         $prod = trim(isset($_request['prod'])) ? $_request['prod'] : '';         $brand = trim(isset($_request['brand'])) ? $_request['brand'] : '';         $prodname = trim(isset($_request['prodname'])) ? $_request['prodname'] : '';         $price = trim(isset($_request['price'])) ? $_request['price'] : '';         if(isset($_request['userid'])){              $userid = $_request['userid'];                                     }          echo $userid;           <form action="<?php echo $self ?>" method="post">             <br>              <select name="userid" id="userid" >                   <option value="criteria" name="criteria">select criteria</option>                   <option value="prod" name="prod">product</option>                   <option value="brand" name="brand">brand</option>                   <option value="price" name="price">price</option>                   <option value="prodname" name="prodname">name</option>             </select>               <br>                    search :<input name="<?php echo $_request['userid']; ?>" type="text" value="<?php echo $_request['userid']; ?>"  ><br>                        <br><input type="submit" name="submit" value="search">             </form> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -