Pos3id0nas Posted November 18, 2021 Share Posted November 18, 2021 Hello,i am new in sport and i'm wonder if could helping me to resolve an issue. I want to redirect after the successful login of user to different page accordingly the enum input. here is my code and my db. Quote Link to comment https://forums.phpfreaks.com/topic/314246-user-redirection-accordingly-an-enum-input/ Share on other sites More sharing options...
Barand Posted November 18, 2021 Share Posted November 18, 2021 Where does $row get its values? Quote Link to comment https://forums.phpfreaks.com/topic/314246-user-redirection-accordingly-an-enum-input/#findComment-1592222 Share on other sites More sharing options...
gizmola Posted November 18, 2021 Share Posted November 18, 2021 My First comment: Don't use enums. I would recommend changing the definition of the field to a CHAR[1], and store either a 'P' or an 'S'. Your code should not interpolate values into your SQL even if you are escaping them. Use Prepared Statements. Your redirection code should be changed: if ($specialty == "pro") { header("Location: pro.php"); } elseif ($specialty == "stu") { header("Location: stu.php"); } else { die('Unknown Specialty.') } Note format of the Location header. Quote Link to comment https://forums.phpfreaks.com/topic/314246-user-redirection-accordingly-an-enum-input/#findComment-1592232 Share on other sites More sharing options...
Barand Posted November 18, 2021 Share Posted November 18, 2021 Erm! @gizmola Note that in the English speaking parts of the world we have "speciality" and not "specialty" 😀 Quote Link to comment https://forums.phpfreaks.com/topic/314246-user-redirection-accordingly-an-enum-input/#findComment-1592234 Share on other sites More sharing options...
gizmola Posted November 18, 2021 Share Posted November 18, 2021 31 minutes ago, Barand said: Erm! @gizmola Note that in the English speaking parts of the world we have "speciality" and not "specialty" 😀 Hey I didn't name the field 😅 But my american upbringing says that "specialty" is good. I do like the english pronunciation of spe-cee-al-it-tee of your version though. Quote Link to comment https://forums.phpfreaks.com/topic/314246-user-redirection-accordingly-an-enum-input/#findComment-1592237 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.