How to post the username from Moodle to a separate PHP page?

How to post the username from Moodle to a separate PHP page?

by Leszek Jabłoński -
Number of replies: 2

On my Moodle site I made a link to a separate PHP web page quiz.php where I put a simple quiz that collects data and then writes them (username, answers and points) into a table of mysql database (with help of another PHP page process.php). When I am click the link, which is on the Moodle, to quiz.php, I would like to transfer the username of Moodle there, so that when I click on the Submit button, I can go to another PHP file process.php processing all the data, the username from the Moodle site included. Is there a way to post a username from Moodle to a separate PHP file? I would like to do that in order to identify who made the test. The users could also write their name in the form of quiz.php file but using the Moodle username would be much better.

Average of ratings: -
In reply to Leszek Jabłoński

Re: How to post the username from Moodle to a separate PHP page?

by Just H -

Use the variables setting when adding the link (see here for very brief info).

In reply to Just H

Odp: Re: How to post the username from Moodle to a separate PHP page?

by Leszek Jabłoński -

Thank you, I tested it on my local computer because on my Internet Moodle site the "Link to a file or website" does not work. I will post another question to this forum - maybe there is a way to repair this disfunction.