Redirect to another URL - Can't get...

User 2582728 Photo


Registered User
48 posts

Inching my way forward toward a complete site, and just ran into a challenge using the WBF "Confirm Options" option to redirect to another URL. As the topic states, when I try to make use of the form results in $_REQUEST, $_POST or $_GET, they are all empty.

On the Confirm Options tab in WBF Settings for my form, I have selected "Redirect to another URL", and filled in the URL as follows:

/localhost/hlv/test.php

Note: I wanted to use a relative URL reference, but that's still a bit funky on my home wamp setup (I probably have to set document root or something like that). But for now, the absolute reference does, indeed, find the "testrequest.php" file above.

My assumption was that by specifying this redirect, I could create my own php page (or CGI or whatever) and make use of the REQUEST info. Is that incorrect? Is there something else I should be doing?

My "testrequest.php" contents:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>
<body>
<?php

// display some diagnostics output so we can see what was received from the form, and how we interpreted it
echo '<p></p> <p></p> <p></p> <p></p> <p></p> <p>Request was: </p>' . PHP_EOL;

echo print_r($_REQUEST,TRUE) . '<p> </p>' ;
echo '<p></p> <p></p> <p>POST was: </p>';
print '<pre>';
print_r($_POST);
print '</pre>';
echo '<p></p> <p></p> <p>GET was: </p>' ;

print '<pre>';
print_r($_GET);
print '</pre>';

echo print_r($_REQUEST,TRUE) . '<p> </p>';

echo '<p>Formatted calculator input string is: </p>';
?>
</body>
</html>


...and the results when the page is called (with PHP working, and the page loaded through the wamp stack looks like this:

Request was:

Array ( )
POST was:

Array
(
)
GET was:

Array
(
)
Array ( )


What am I doing wrong? When I choose the "redirect" option, do the form request not get passed along to the page I specify in redirect?
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

Replace the form builders myformname.php with your own. That's where you can catch all the variables to use as you need.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2582728 Photo


Registered User
48 posts

Thanks Eric - as I look closer, that makes sense. I'll be giving it a try in the morning. Thanks for the quick reply!

Jon
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

The nice thing about this is that all the validation will still works as you built it in the form builder. Make sure you take the proper steps to protect yourself from sql injection by using
Examples:

$myvariable = stripslashes($myvariable);
$myvariable = mysql_real_escape_string($myvariable);

If you need any help let me know. I have built a bunch of custom php scripts working with the form builder including using $_SESSION's and mysql database.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.