Hello
I am working in moodle and its code base is in PHP. I am a novice to moodle as well as PHP and not quite familiar with PHP syntax.
Right now I have built a Web page in moodle, and its view.php file I need to implement a fuctionality on click of a button.
On click of submit button, I am trying to implement a functionality and I have written the code for that under if(isset($_POST['submit]))
{ ...my code...}
Also while creating the form I have set the attributes as follows:
echo "<form method='post' action='" . $_SERVER['PHP_SELF']."?inpopup=". $_GET['inpopup']."&id=" . $_GET['id'] . "'>";
But irrespective of whether or not I click the button, whenevr the page loads for the first time, it perform the code written in IF loop as well.
So Am i going wrong in implementing a functionality on click of button in PHP or is it something related to moodle, if anyone knows?
Any help or suggestions would be appreciated. As I am stuck with this logic since last three days.
Regards