Retain the page update by Javascript and run the PHP code?
<p>In a php project I need to add items to database, list them &amp; allow the user to edit &amp; update items using a single page.</p>

<p>This is my code to edit item link in HTML table</p>

<pre><code>echo  '&lt;a href="  '.$_SERVER['PHP_SELF'].'?name=edit&amp;id='  .$rowCountry-&gt;CountryId .' " id="edit"  onClick="MyFunction()"&gt; Edit &lt;/a&gt;';
</code></pre>

<p>When a user click on the above link I need to hide <code>Add</code> button and display two new buttons to <code>Update</code> &amp; <code>Cancel</code> the edit +  display selected item name in a Text box to Edit. </p>

<p>To hide and display buttons I'm using jQuery and to display the item name i need to use PHP.
Here when i put PHP code and reload the page with <code>$_SERVER['PHP_SELF']</code> (as in above code), hiding &amp; displying of buttons is lost after the page load. (If I remove the <code>_SERVER['PHP_SELF']</code> code from link it hides and display buttons as expected (but no php code run))</p>

<p>How can I retain the page update by Javascript and run the PHP code?</p>

<p>I'm new to PHP am I missing something in my code?</p>
