PHP and (isset($_POST[''])) issue
<p>Apologies if this question is duplicated, I have however not found an obvious answer to my question. I am a complete novice with <a href="/questions/tagged/php" class="post-tag" title="show questions tagged &#39;php&#39;" rel="tag">php</a>, be kind! When I load the following code, it appears to run <code>if(isset($_POST['test']))</code> even though I have not pressed the button <code>"test"</code>. I only want the code to execute when I press the "<code>test</code>" button. How do I resolve this?</p>

<pre><code>&lt;?php
    if(isset($_POST['update'])) {
        $content=simplexml_load_file("books.xml");
        $value=$content-&gt;book-&gt;price;
        $sum=$content-&gt;book-&gt;price;
    }

    if(isset($_POST['test'])) {
        $content=simplexml_load_file("books.xml");
        $value=$content-&gt;book-&gt;price;
        $content-&gt;book-&gt;price = $value + 1.0;
        $content-&gt;asXML("books.xml");
        $sum=$content-&gt;book-&gt;price;
    }
?&gt;

&lt;body&gt;
    &lt;form method="post"&gt;
        &lt;input type="checkbox" id="i1check1" onchange="toggleDisabled(this.checked)"&gt; Alarm 01
        &lt;input type="text" id="i1text1" name="i1" size="80" maxlength="128" value="&lt;?php echo @$sum;?&gt;"/&gt;
        &lt;input type="submit" id="i1btn1" name="update" value="Update"/&gt;
        &lt;input type="submit" id="i1btn2" name="test" value="Test"/&gt;
    &lt;/form&gt;

    &lt;script&gt;
        function toggleDisabled(_checked) {
            document.getElementById('i1text1').disabled = _checked ? false : true;
            document.getElementById('i1btn1').disabled = _checked ? false : true;
        }
    &lt;/script&gt;
&lt;/body&gt;
</code></pre>