livethedead Posted February 13, 2012 Share Posted February 13, 2012 Alright I've racked my brain over and over, and to me it seems completely illogical that this isn't fucking working. At this point I'm starting to get angry and I really need someone to explain to me why this doesn't work because I refuse to move on in my studies until I figure this out. I would really appreciate it. note: I didn't post this in regex because it's nothing to do with the regex really. Everything works just golden except the last if statement. If I enter say "a"" in the facebook form, it will return "a", instead of: "facebook.com/a". I seriously cannot fathom why and need help. I've tried else, elseif, if in varying orders thinking maybe I just lack understanding of them but no. So that's why I have it currently placed idioticly in 3 if statements. <?php $first_name = trim($_REQUEST['first_name']); $last_name = trim($_REQUEST['last_name']); $email = trim($_REQUEST['email']); $facebook_url = trim($_REQUEST['facebook_url']); $facebook_url_check = false; if (preg_match("/facebook.com\/|facebook.org\/|facebook.net\//", $facebook_url)) { $facebook_url_check = true; } if ($facebook_url_check = true) { $facebook = preg_replace("/facebook.org\/|facebook.net\//i", "facebook.com/", $facebook_url); } if ($facebook_url_check = false) { $url = "facebook.com/"; $facebook = $url . $facebook_url; } ?> Link to comment https://forums.phpfreaks.com/topic/256988-i-think-ill-snap-my-keyboard/ Share on other sites More sharing options...
scootstah Posted February 13, 2012 Share Posted February 13, 2012 Because you're using an assignment operator instead of a comparison operator. if ($facebook_url_check == false) { Notice the two "="s EDIT: By the way, you'll probably get more help if you use descriptive titles. Link to comment https://forums.phpfreaks.com/topic/256988-i-think-ill-snap-my-keyboard/#findComment-1317432 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.