refiking Posted January 24, 2008 Share Posted January 24, 2008 I am working on allowing my users to paste a code snippet from You Tube on my site and store it as their "viedopic". I already have the "videopic" coded. What I need help with is changing the code they input before I store it to fit my parameters. For example, here is a snippet of code from a You Tube video: <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/CoiFGva_JoY&rel=0&color1=0x5d1719&color2=0xcd311b&border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/CoiFGva_JoY&rel=0&color1=0x5d1719&color2=0xcd311b&border=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object> I'd like to change to make the following changes on the fly (before I add it to the db): 1) Change width to 400 2) Change height to 400 3) Replace everything from the "&" to the quotes with this: &autoplay=1&rel=0&color1="black"&color2="black" Quote Link to comment https://forums.phpfreaks.com/topic/87505-change-form-data-before-i-store-it/ Share on other sites More sharing options...
rajivgonsalves Posted January 24, 2008 Share Posted January 24, 2008 you can use str_replace or preg_replace http://php.net/str_replace http://php.net/preg_replace Quote Link to comment https://forums.phpfreaks.com/topic/87505-change-form-data-before-i-store-it/#findComment-447596 Share on other sites More sharing options...
Kingy Posted January 24, 2008 Share Posted January 24, 2008 what you should do is just have the user post the url instead of the the hole <object> that why you are in control of everything that happens in the object parameter, then all you need to do is call the url $url = $row['url']; <object value='$url'></object> Quote Link to comment https://forums.phpfreaks.com/topic/87505-change-form-data-before-i-store-it/#findComment-447597 Share on other sites More sharing options...
refiking Posted January 24, 2008 Author Share Posted January 24, 2008 OK. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/87505-change-form-data-before-i-store-it/#findComment-447601 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.