Create a text field by name valinside the form in the index file, for example:
<form action="search.php" method="post">
<input type="text" name="val" value="search string" />
</form>
And now you can get it as:
<?php echo $_POST['val']?>
If you need this value in the URL, you must change the form method to get, for example:
<form action="search.php" method="get">
<input type="text" name="val" value="search string" />
</form>
and then you can get its value on the search page, for example:
<?php echo $_GET['val']?>
action form, val:
<form action="search.php?val=<?php echo $search_string;?>" method="get">
</form>
, :
<?php echo $_GET['val']?>