pneudralics Posted November 8, 2008 Share Posted November 8, 2008 The form below uploads youtube video link ex: To the database. I want the ease of just copying the link but want to get rid of "http://www.youtube.com/watch?v=" when I upload the link to my database. How would I filter that out. <?php //This is the page for the video section include ('header.php'); //Retrieve video info $videoselect = "SELECT * FROM video"; if ($videoresult = mysql_query ($videoselect)) { while ($row = mysql_fetch_array ($videoresult)) { $url = $row['url']; $description = $row['description']; ?> <table width="800" align="center"> <tr> <td align="center"> <object width="425" height="344"> <param name="movie" value="<?php echo "$url"; ?>&hl=en&fs=1"></param> <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="<?php echo "$url"; ?>&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed> </object> <br /> <?php echo "$description"; ?> </td> </tr> </table> <?php }//End while loop }//end if while ?> Link to comment https://forums.phpfreaks.com/topic/131911-solved-how-do-i-delete-certain-amount-of-characters-when-i-upload-from-a-form/ Share on other sites More sharing options...
Mchl Posted November 8, 2008 Share Posted November 8, 2008 I'd do: $url = "http://www.youtube.com/watch?v=Enbn063Ndg0"; $arr = explode("?v=",$url); $videoID = $arr[1]; Link to comment https://forums.phpfreaks.com/topic/131911-solved-how-do-i-delete-certain-amount-of-characters-when-i-upload-from-a-form/#findComment-685285 Share on other sites More sharing options...
pneudralics Posted November 8, 2008 Author Share Posted November 8, 2008 Posted the wrong page but I got it thanks to the explode. I actually did this and it worked: $url = $_POST['url']; $url = trim(htmlentities(substr_replace("$url","",0,31))); Link to comment https://forums.phpfreaks.com/topic/131911-solved-how-do-i-delete-certain-amount-of-characters-when-i-upload-from-a-form/#findComment-685301 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.