Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3641

How to embed youtube links to IF statements

$
0
0
<h1>I LOVE YOU</h1><formaction="practice.php" method="post"><select name="option"><option class="hiddenOption"></option><option>I love you, too!</option><option>Sorry I love someone else</option></select> <br><input type="submit" name="submit"></form><?php if (isset($_POST['submit'])): ?><?php      $option = $_POST['option'];      $op1 = "I love you, too!";      $op2 = "Sorry I love someone else";     if ($option == "I love you, too!") {      $url = "https://www.youtube.com/watch?v=a7fzkqLozwA&feature=relate";      parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );      echo $my_array_of_vars['v'];    }    ?><?php endif; ?>

I want to link a youtube video based on what the users choose from the options. Then autoplay it on the website after the user submit their options. What is the best or effective solution to this? Thank you.

link for the first option:https://www.youtube.com/watch?v=a7fzkqLozwA ,link for the second option:https://www.youtube.com/watch?v=0xgaqhe5QiM


Viewing all articles
Browse latest Browse all 3641

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>