Q:

Html5 video, using php variable as source

<!DOCTYPE HMTL>
<html>
<?php
$movie1 = 'movie1.mp4';
echo $movie1;
echo '<center>';
echo '<video width="600" height="300" controls>';
echo '<source src= "$movie1" type="video/mp4">';
echo "Your browser does not support the video tag.";
echo '</video>';
?>
</html>

I'm learning php and html now and I was wondering why it can't recognize the variable $movie1. The video player only shows blank. 
I tried putting the "movie1.mp4" directly as source and it works fine. 
Is there something I'm missing here? thanks in advance

A:

First, an HTML stickler. You have a typo in HMTL and should read as HTML and you'll get a warning about that.
Then you need to concatenate your variable "$movie1" to "'.$movie1.'".
You should use proper HTML markup also, as in adding <head><title><body> tags if you're going to learn HTML. You also had a missing closing </center> tag, but that won't stop it from working, but should be using a <div> to align it with and closing the div.
Here's a rewrite:
<!DOCTYPE HTML>
<html>
<head>
<title>Your title</title>
</head>
<body>
<?php
$movie1 = 'movie1.mp4';
echo $movie1;
echo '<div align="center">';
echo '<video width="600" height="300" controls>';
echo '<source src= "'.$movie1.'" type="video/mp4">';
echo "Your browser does not support the video tag.";
echo '</video>';
echo '</div>';
?>
</body>
</html>

Plus, make sure you have a web server/PHP installed and accessing it as http://localhost(orYourHost)/file.php rather than a probable c:///file.php.
A web browser will not parse PHP directives if you're using c:///file.php directly into your web browser. You also need to make sure that it is a .php extension file. If you're using .html as a file extension, then that won't parse the PHP directives unless you instructed your system to treat .html files as PHP.

Footnotes:
The <center> tag has been deprecated/removed.
Consult:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center

"Deprecated
  This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time."

