Trying to change submit value on click

I have a list of posts in my page, and I also have a form to search for posts.

This is my form:

<form  action="" method="post">
  <input type="text" name="search"  onclick="if(this.value=='Search:')this.value=''" onblur="if(this.value=='')this.value='Search:'" value="Search:" />
  <input type="submit" value="Search"  name="sendForm" />
</form> 

And then, when my form is submited with some values I store a session with my sql condition statment and I get only my list of news that have title like the value I wrote in my input.

And then, If I submit my form without any value I unset my session and I get my list of all news again.

if(isset($_POST['sendForm'])){
    $search = $_POST['search'];
    if(!empty($search) && $search != 'Search:'){
    $_SESSION['where'] = "WHERE title LIKE '%$search%'";
        header('Location: dashboard.php?exe=posts/index');
    }
    else{
        unset($_SESSION['where']);
    }
 }

And now I need to change value of my input sumbit when I click in it, when I submit.

At first, my submit value is “Search”, and when I click in it I want to change this value to “Clear”. And when I click in “Clear” I want to change to “Search” again.

Do you know how can I do this correctly?

Im trying like this, but its not working fine:

<input type="text" name="search"  onclick="if(this.value=='Search:')this.value=''" onblur="if(this.value=='')this.value='Search:'" value="Search:" />
  <input type="submit" value="Search"  onclick="if(this.value=='Search:')this.value=''Clear"  name="sendForm" />

I see no need for all the JS. Just base button value on session.

<?php
$button = (isset($_SESSION['where']) ? 'Clear' : 'Search');
?>
<input type="submit" name="sendForm" value="<?php echo $button;?>" />