如何在POST之后和之后单击后将搜索词粘贴在框中[关闭]

Does anyone know how to make a search term stick into the search after the POST is made, which is my current method. I need the search term to stick in the searchbox even after clicking on somthing else in the site. Here is my current code-

<input type="text" name="searchterm" <?php if(isset($_POST['searchterm'])){echo 'value="'.$_POST['searchterm'].'"';} ?>>

I need it to stick their until its changed again

Below is my php code for the action

      <?php
if (isset($_POST['search']))
{
$_SESSION["search_fields_value"] = $_POST;
$searchterm  = $_POST['searchterm'];
$query="SELECT * FROM transactions  WHERE id LIKE '%$searchterm%' OR date LIKE '%$searchterm%' OR propertydescription LIKE '%$searchterm%' OR transactiontype LIKE '%$searchterm%' OR applicabledocument LIKE '%$searchterm%' OR received LIKE '%$searchterm%' OR paid LIKE '%$searchterm%' OR toJLP LIKE '%$searchterm%' OR agentclient LIKE '%$searchterm%'";
$result = mysql_query ($query) or die(mysql_error());
}
else
{
$query="SELECT * FROM transactions" ;
$result = mysql_query ($query) or die(mysql_error());
}
$num=mysql_numrows($result);
mysql_close();
?>

You can keep the $_POST values in session. So you can use in pagination also.

In search action section,

$_SESSION["search_fields_value"] = $_POST;

In search view form

$existing_values = array("search_term"=>"");// to use in the first time before search 
if(isset($_SESSION["search_fields_value"]))
  $existing_values = $_SESSION["search_fields_value"];

In your form,

<input type="text" name="searchterm" value='<?php echo $existing_values ['searchterm']; ?>'>

You can use sessions on server side, or use a client-side solution like localStorage