In register.inc.php i have this code
header("Location: ../register.php?u=".$ref."&error=passwordcheck&uid=".$username."&mail=".$email."&name=".$name);
exit();
and in register this line
if ($_GET["error"] == "&error=passwordcheck&uid=&mail=&name=") { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
Passwords dont match!
Usually it works but on this page the alert is not showing up to the user if the passwords dont match. What am i doing wrong?
this is the header in case of error in frontend
mydomainname.com/register.php?u=0&error=passwordcheck&uid=test1&mail=test1@gmail.com&name=test
edit: I feel ashamed asking such an easy question when i have solved much harder issues.
>Solution :
You have not understood HTTP query string parsing.
Here’s how it works: the query strings are separated using &, so:
?u=0&error=passwordcheck&uid=test1&mail=test1@gmail.com&name=test
is split into:
- u = 0
- error = passwordcheck
- uid = test1
- mail = test1
- name = test
So, use:
if ($_GET["error"] == "passwordcheck") { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
Passwords dont match!