PHP Question

Variables not passed in url and page not displaying

I am redirecting a user to a page named "forgot_pass" in such a way

"forgot_pass.php?code='$code'&username='$hidden_username'>"
.

But when user clicks on link for redirection the url seems like this

http://localhost/Validation/forgot_pass.php?code=


and there is no any page displayed.
The variables passed in url have values as i have already checked it. But they are not displaying when sent in url.

Help me in solving this issue.

reset.php

<?php
ini_set("display_errors", TRUE);
require_once './include/db_connection.php';

$pass = $_POST['pass'];
$pass1 = $_POST['pass1'];
$code = $_GET['code'];
$hidden_username = $_POST['username'];
if($pass == $pass1)
{
echo 'Password Changed !';
}
else
{
echo "Passowrd must match
<a href='forgot_pass.php?code='$code'&username='$hidden_username'>Try Again</a>

";
}


forgot_pass.php

<?php

ini_set("display_errors", TRUE);
require_once './include/db_connection.php';
if(isset($_GET['code']))
{
$get_code = (isset($_GET['code'])? $_GET['code'] : null);
$get_username =(isset($_GET['username']) ? $_GET['username'] : null);

$match_code = mysqli_query($link, "select * from signup where username='$get_username'");
if(mysqli_num_rows($match_code) > 0)
{
while($row = mysqli_fetch_assoc($match_code))
{
$db_username = $row['username'];
$db_code = $row['paareset'];
}
}

if($get_username == $db_username && $get_code == $db_code)
{ ?>
<html>
<head>

<meta charset="UTF-8">
<title>Change Password</title>

</head>
<body>
<div class="container">
<div class="row">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-body">
<div class="text-center">
<h3><i class="fa fa-pencil fa-4x"></i></h3>
<h2 class="text-center">New Password?</h2>
<div class="panel-body">

<form class="form" method="post"
action= "reset_pass.php?code=<?php echo $get_code ?>"
<fieldset>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil color-blue"></i></span>

<input name="pass" placeholder="New Password" class="form-control" type="password" required="">
</div>

</div>

<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil color-blue"></i></span>

<input name="pass1" placeholder="Re-type Password" class="form-control" type="password" required="">
<input type="hidden" name="username" value="<?php echo $db_username ?>">
</div>

</div>
<div class="form-group">
<input class="btn btn-lg btn-primary btn-block" name="send" value="Change Password" type="submit">
</div>
<div class="form-group">
<span style="color: red"><?php if(isset($message['mail'])) {echo $message['mail']; } ?></span>

</div>
</fieldset>
</form>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</body>
</html>

<?php

}
} // End if (isset['code'])


if(!isset($_GET['code']))
{

?>
<html>
<head>
</head>
<body>
// Here i am displaying another form that gets email address and sends email
</body>
</html>

<?php
}

Answer

you have mismatch in columns

try to change your code to

echo "Passowrd must match
        <a href='forgot_pass.php?code=".$code."&username=".$hidden_username".'>Try Again</a>

        "