Copy link to clipboard
Copied
Hello all,
I am using the canonical Dreamweaver/PHP construct to direct to another php page upon submit.
$insertGoTo = "confirm_submission.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
Is it possible to pass additional values to the "confirm_submission.php" page? I know how to do this using a regular URL GET method. Doing so with the above construct is a bit less clear.
I neglected to mention that these are form variables that I am interested in passing.
Thanks!
Message was edited by: ByteSmythe (added clarity regarding form variables)
Yeah. Use the if/else to check and append the first value but after that it's safe to assume that the querystring exists so just concatenate the other key/values pairs.
>Also, I have one value that I want to pass hidden.
I'd probably use a session variable for that.
Copy link to clipboard
Copied
I found an old post by David that suggests
// if a query string has been added, add the value at the end
// otherwise, create a query string to add value
if (strpos($insertGoTo, '?')) {
$insertGoTo .= '&rep_fname=' . $_POST['RepFname'];
} else {
$insertGoTo .= '?rep_fname=' . $_POST['RepFname'];
}
header(sprintf("Location: %s", $insertGoTo));
Which appears to work when I access the variable via $_GET['rep_fname'] in the php file to which the user is redirected. It seems a pity to have to do this for 10 variables but I suspect this is cleaner than using something a global session variable ($_SESSION).
Copy link to clipboard
Copied
>It seems a pity to have to do this for 10 variables
You probably don't need to test if the querystring exist for anything except the first value. That will streamline things quite a bit.
Copy link to clipboard
Copied
>You probably don't need to test if the querystring exist for anything except the first value. That will streamline things quite a bit.
Good point. You're saying simply concatenate the remainder onto $insertGoTo?
Also, I have one value that I want to pass hidden. What is the best way to do that? As a form value? Sorry if this is an FAQ. I am a long time HTML/CGI programmer and new to PHP via Dreamweaver.
Copy link to clipboard
Copied
Yeah. Use the if/else to check and append the first value but after that it's safe to assume that the querystring exists so just concatenate the other key/values pairs.
>Also, I have one value that I want to pass hidden.
I'd probably use a session variable for that.
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
> I'd probably use a session variable for that.
If a user blocks cookies won't that effect the ability to use session variables?
Copy link to clipboard
Copied
>If a user blocks cookies won't that
>effect the ability to use session variables?
Yep. It's difficult to build secure systems without sessions. Modern browsers typically allow the user come control over what types of cookies they will allow, such as only allowing session cookies. It's hard to surf the net these days if you are blocking all cookies.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more