Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Possible to use PHP to embed Youtube Videos

    Was just wondering if it was possible to do this.

    My think was to have a input box that the user could paste the youtube link into. This would then save the path to the file in the database and then when viewing the selected item it would use the url to get the video.

    Would i be along the right lines or is this not even possible?

  • #2
    Banned
    Join Date
    Feb 2008
    Location
    Winnipeg, Canada
    Posts
    396
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try:

    PHP Code:
    <?php

    if ($_SERVER["REQUEST_METHOD"] == "POST") {

    ?>
    <object width="425" height="350">
    <param name="movie" value="http://www.youtube.com/v/<?php echo $_POST["YouTubeID"]; ?>"> </param> <embed src="http://www.youtube.com/v/<?php echo $_POST["YouTubeID"]; ?>" type="application/x-shockwave-flash" width="425" height="350"> </embed> </object>
    <?php

    } else {

    ?>
    <form method="post" action="">
    YouTube ID: <input type="text" name="YouTubeID" />
    </form>
    <?php

    }

    ?>

  • #3
    New Coder
    Join Date
    Feb 2008
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Cheers mate, thought it was simple, and it was.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •