i want to share a video link from youtube in textarea and show on the div ,when im share embeded code from youtube it showed on the div but when im share the link ,it only show the link so how i ll i share link in same way as embedeb code ??

  echo $_SESSION['email_id'];
  $sql="select * from post where post_id='$user_id'";
    { $description=$row['description'];
$date=@date('Y-m-d H-i-s');
$post="INSERT INTO `post`(`post_id`,`comment_id`,`user_id`,`description`,`date`) VALUES(NULL,0,'$user_id','$description','$date')";
 //echo $result;

//and the div where it show
<div class="posted">
       <?php  echo "$user_name"." "."$user_lname";?>
        <?php echo $description;?> 

Member Avatar for diafol

You can set up your table to just hold the video identifier, e.g. Ujwod-vqyqA
You can then build the embed link dynamically through php.

$videoframe = "<iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/$video_id\" frameborder=\"0\" allowfullscreen></iframe>";

This has the advantage of not having to update ALL your video embed codes in a table if you want to change say the dimensions or if, perish the thought, YT decide to change the format of its embed code (can't see that happening though).



video_id [32]
video_identifier [Ujwod-vqyqA]
video_type_id [2]


video_type_id [2]
video_supplier [YouTube]
embed_code [<iframe width="560" height="315" src="http://www.youtube.com/embed/#VIDEO#" frameborder="0" allowfullscreen></iframe>]

You then replace the #VIDEO# string with video_identifier, e.g. str_replace()

Your import code for the textarea can strip the embed code to leave just the video_identifier before inserting it into the DB. You could use regex for this (based on the 'src=').

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.