为Google自动填充文本框设置输入值

I have a form which allow users to enter addresses (google places autocomplete). when that form is submitted, the value is stored as a $_SESSION variable and post. Now when the user clicks back, I want to set the value of the address input box with the $_SESSION variable but I can't seem to get it working.

<input class="form-control" name ="collectPoint"  required="true"  type="text" id="search-field-from" <?      
       if(isset($_SESSION['collectPoint'])){echo 'value =$_SESSION['collectPoint']';}
             else{ echo 'placeholder="Collection Location"';} ?> >

Try as below :

<?php
if(isset($_SESSION['collectPoint']))
{
    $collectPoint = "value='".$_SESSION['collectPoint']."'";
}
else
{ 
    $collectPoint = "placeholder='Collection Location'";
} ?>    


<input class="form-control" name ="collectPoint" required="true" type="text" id="search-field-from" <?php echo $collectPoint; ?>/>