In a php project I need to add items to database, list them & allow the user to edit & update items using a single page.
This is my code to edit item link in HTML table
echo '<a href=" '.$_SERVER['PHP_SELF'].'?name=edit&id=' .$rowCountry->CountryId .' " id="edit" onClick="MyFunction()"> Edit </a>';
When a user click on the above link I need to hide Add button and display two new buttons to Update & Cancel the edit + display selected item name in a Text box to Edit.
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 $_SERVER['PHP_SELF'] (as in above code), hiding & displying of buttons is lost after the page load. (If I remove the _SERVER['PHP_SELF'] code from link it hides and display buttons as expected (but no php code run))
How can I retain the page update by Javascript and run the PHP code?
I'm new to PHP am I missing something in my code?