I am trying to store $_GET
in variables and re-use them in a POST request, but the problem is that as soon as a POST request is sent the URL becomes empty and there is nothing to store in variables or the data stored in variables is removed as there is nothing in the URL
success.php?email=16564017@gmail.com&token=M3XK5HeCZy
Current URL
after a POST request is sent the URL is success.php
leaving nothing to store,
I'm trying to update passwords of users on basis of this method
I've tried this with $_SESSION
, but cannot figure it out, My current work
if(!$_GET['email'] && !$_GET['token']) {
header("Location: register.php");
}
else {
$arrayCookie = array('email' => $_GET['email'] , 'token' => $_GET['token']);
$json = json_encode($arrayCookie);
setcookie('data',$json,time()+(8400));
$cookie = $_COOKIE['data'];
$cookie = stripslashes($cookie);
$cookieSavedArray = json_decode($cookie,true);
print_r($cookieSavedArray);
include 'UserActions.php';
$msg="";
$checkEmail = new UserActions();
$checkEmail->databaseConnection('localhost', 'root', '', 'placement2018');
}
HTML Form
<form action="success.php" enctype="multipart/form-data" method="post">
<div class="col-sm-12">
<div class="form-group">
<label>Password</label>
<input type="password" name="pass" placeholder="Enter password" class="form-control" required>
</div>
<div class="form-group">
<label>Confirm Password</label>
<input type="password" name="confirmpass" placeholder="Confirm password" class="form-control" required>
</div>
<input class="btn btn-lg btn-info" type="submit" name="addPassword" value="Submit">
</center>
Now, as soon as I submit the form, the URL parameters are not there anymore, so I want to store the URL parameters as I need to run queries based on it.
How do I store $_GET parameters such that they remain in a $_POST request as well?