To directly address the issue - your problem is that you are
using HTML and calling the PHP functions within this file.
That doesn't work (as you can see....)
The reason is simple - and if you keep this in mind, you can use PHP in HTML files (and with great success as pages load faster when done properly as discussed here, here and all over SO when talking about various frameworks like Zend, etc....)
How to properly use PHP in an HTML file
Be very careful that you are using PHP information as a 'template' and/or pulling data as the page loads. This is the mistake in the original question - you can't get data from PHP after the page loads (well, you can, just not directly - see below).
See the links referenced for examples of how to properly do this. As the page is loading, you grab data from PHP variables and place them into input values (or whatever you need). One thing to watch out for here is running long PHP functions that gather lots of data, etc. A rule of thumb is to watch out for page 'time to display' and not use lots of functions, though variables that are set on page initialization (like gathering a user's permissions before allowing them to see the page, etc.) are quite acceptable (this is more advanced than your question, though certainly how frameworks and such are built).
2) For data that takes a 'long' time to load (like those functions mentioned above), as well as EVERY time you need to do what you are trying to do....
using HTML and calling the PHP functions within this file.
You MUST use JS and AJAX to call the PHP page and gather the data. There are tons of questions about using AJAX on SO and all over the web - read and learn about that - you will use it a LOT on making pages where you need data and/or action from PHP pages.
3) Get it in your head about 'mixing JS/PHP/HTML in one file'. What you MUST do (if you are going to ever mix them - I believe the above statements clarify when/how that is done - including in major frameworks, etc...) is what I call "jump in/out of HTML/PHP". The links to the other SO questions show this, though here is an example broken down:
Start the page with PHP
Here you might need to authorize the user, etc. (one example would be to look at the PHP session and validate against a server - this gets too complex for this answer so I will keep it short)
<?php
// gather authorization and other "can't view the page without it" variables here. For our example, we will say that you have the $course variable
$course = "mycourse";
// 'jump out' of PHP and 'into' HTML by closing the PHP
?>
Now you are in HTML
You can so something like set an input to the 'course' so when the page is displayed you see that in the input box (this is a very proper and common use of HTML/PHP on a page - regardless of if JS is on there or not...)
<input type="text" id="thecourse" name="thecourse" value="
we need the variable from PHP so again we 'jump' and go to PHP, echo the variable and then back out to HTML
<?php echo $course; ?>
and finish the HTML
">
Well, that is a long explanation of those examples referenced, though I trust it will help!
Another way to do it (using JS and PHP on the same page) is with something like
<script>
// Note here that we 'jump' out of HTML and into JS!
// also note that I'm using jQuery here as it is commonly used today
$("#thecourse").val('<?php echo $mycourse;?>'); // again a 'jump' to/from PHP - within JS!
// now, 'jump out' of JS and back to HTML...
</script>
There is a lot to learn about getting data moved around and formatted (and all the language differences on how to do that). Over time you will learn, though, for now, get your head around the 'jump' idea and you can do a lot of interesting things - with fast page loads showing data instantly!