Hi there,

How can I ignore case sensitivity when people type in letters and get redirected through this script:

if($_GET['username'] == "BBY"){
  header("Location: http://www.x.ca"); }
   elseif($_GET['username'] == "RS"){
  header("Location: http://www.x2.ca"); }  
   elseif($_GET['username'] == "WM"){
  header("Location: http://www.x3"); }  
   elseif($_GET['username'] == "RP"){
  header("Location: http://www.x4.ca"); }
   elseif($_GET['username'] == "SM"){
  header("Location: http://www.x5.ca"); } 
  else {
  header("Location: ../portal_failedattempt");


Thank you! :)

Recommended Answers

All 7 Replies

strcasecmp('Hello', 'HELLO') == 0 - when strings are identical, regardless of case

Thank you very much for all your help!

Actually it doesn't work. Can you please show it to me using my code as an example? I'm not quite advanced with PHP I'm sorry :s

Member Avatar

Like this?

if(strtoupper($_GET['username']) == "BBY"){


if(strcasecmp($_GET['username'], 'BBY') == 0) {
    // true

Thanks blocblue! Now it all works perfectly!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.