Jump to content

[SOLVED] How do I delete certain amount of characters when I upload from a form?


Recommended Posts

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
?>


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.