How do I make an src dynamic?
I have been trying to figure out this all day and I can't seem to figure it out. If I have code such as
How would I make the youtube link dynamic through something such as a user inserted URL. I can't seem to figure out how to make that youtube link change.
<video width="640" height="360" src="http://www.youtube.com/demo/google_main.mp4"
thanks a lot!:)
I really think a PHP form and a $_SESSION variable would be the way to go for changing a videos src attribute based on a users input:
<video controls="controls" width="640" height="360" src="
<?php if (!empty($_SESSION['video_url']))
} ?>" >
Sorry, your crappy Dinosaur of a browser doesn't support current technology. Please get a better one.</video>
<form action="url_check.php" method="post">
<h3>Choose another video by URL</h3>
Video URL: <input type="text" name="user_url" value="" />
<input type="submit" />
I'm still kind of new to PHP myself, hopefully my example works for your purposes.
if(isset($_POST['user_url']) && !empty($_POST['user_url']))
$user_url = $_POST['user_url'];
$_SESSION['video_url'] = $user_url;
echo "I'm not going to change the video for you unfortunately. <a href="url_form.php">Go back</a> and fill in a URL please.";