Hey guys, I have a quick question. I normally only do Front-End but I have just started working more with PHP. So I have a question regarding conditionals. Here is my code:
//I actually get this from when a user posts, this is for demo
$videoURL = "http://www.youtube.com/watch?v=-XjwL9kCmgc";
$parsedURL = parse_url($videoURL);
$values=array_values($parsedURL);
$videoProvider = $values[1]; //prints first value aka host (www.youtube.com)
if($videoProvider != 'www.youtube.com' || $videoProvider != 'vimeo.com') {
$errors[] = "<p>$videoProvider is not allowed. Must be from Youtube or Vimeo!</p>";
}
else if () {
}
else {
//do this... submit form
}
So what's happening is the initial if statment with the || conditional is not excuting it is allowing all videos to submitted still ... I have other conditonals below it that work fine like
`else if (strlen($videoURL)<0){
$errors[] = "<p>Video URL empty!</p>";
}`
Any help would be greatly appreciated! Thanks :)