php - Search form to add "sku" to url -


i have search form refreshes page when submit button hit table of results below. works fine , url http://example.com/?txtkeyword=searchterm want add &sku=123456789 end of url know add sku database need use term $_get[sku]. have tried add form , have been unsuccessful. here form code.

<form name="frmsearch" method="get" action="<?=$_server['script_name']?>">   <table width="100%">     <tr>       <th>search: (keyword/sku)         <input name="txtkeyword" type="text" id="txtkeyword" value="<?=$_get["txtkeyword"];?>" size="40">         <input class="alert button" type="submit" value="search"></th>     </tr>   </table> </form> 

i think need add line:

<form name="frmsearch" method="get" action="<?=$_server['script_name']'&sku='$_get["sku"]?>"> 

this not work. not sure, trying learn php , cannot seem find problem or solution. doing wrong , need right?

thanks ryan

it depends if script looking $_post['sku'] or $_get['sku'] when process it.

if post add new hidden <input>

<input type="hidden" name="sku" value="xxxxx"> 

adding form action work if looks $_get['sku']

edit

if wish echo if there not if isn't this.

<?php echo !empty($_get['sku']) ? '<input type="hidden" name="sku" value="'.$_get['sku'].'">' : ""; ?> 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -