Finding and changing the value of a single "href" value using Simple Html DOM Library
<p>i need help in parsing a href attribute of a single anchore tag and then changing its value in a php file using "simple html dom" library. 
Below is the html code:- </p>

<pre><code>&lt;li id="toggle"&gt; &lt;a id="open" class="open" href="#" style="display: block; "&gt;&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>Now i want to get this specific href value and change it to some page like say, Logout.php depending upon if the user is logged in or not.
And here is my php code:</p>

<pre><code>&lt;?php 
    include 'simple_html_dom.php';
    session_start();
    $html = new simple_html_dom();
    $html-&gt;load_file('index1.php');
     if(!isset($_SESSION['username'])){
       $ret = $html-&gt;find('li[id=hello]');
       $ret = "Hello Guest";
       $tog = $html-&gt;find('li[id=toggle]');
       $tog = "Log In | Register";
     }else{
         $user = $_SESSION['username'];
         $ret = "Hello " . $user;
         $tog = "Log out";
         $hrf = $html-&gt;find('a[id=open]');
         $hrf-&gt;href = 'Logout.php';
      }
  ?&gt;
</code></pre>

<p>Now except finding and changing the "href" value, all other things are working properly. 
Any help is welcomed. Thanks in advance.</p>
