Jump to content

if statements (contains)


Collegeboox

Recommended Posts

My site is a music blogging site where the admins blog music that they have found and I want to make sure that they type in

 

"<iframe width="640" height="360" src="http://www.youtube.com/embed/BPVlNTQRoZk?feature=player_embedded" frameborder="0" allowfullscreen></iframe>"

 

in the textbox rather than this

 

"

 

Ideas?

It's easier to do what thorpe suggests than what you want to do.  Think about it:

 

With thorpe's suggestion, you need to check if the link is valid; that it fits the format you're looking for.  But, you can ensure that the iframe the link goes in is correctly formed as you'd be creating it programmatically.

 

With your idea, you'd need to verify that the iframe is correctly formed AND verify that the link within is also valid.  It's more work for no real gain.

 

Regarding output, well, how were you going to output these iframes originally?  Just take the (hopefully well-formed) iframes from the db and echo them, right?  If that's the case, then why can't you simply echo a premade iframe with the particular link variable as its source? 

 

EDIT: see thorpe's code above.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.