close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using GET instead of POST

Thread began 1/25/2011 11:35 am by jcrockett300688 | Last modified 4/10/2012 7:03 pm by Web Studio West | 1026 views | 4 replies |

jcrockett300688

Using GET instead of POST

After a form is submitted, I need to pass certain form data to a thank-you page so I can process it into a printable user name tag. I tried setting the form to GET instead of POST but that breaks everything (no form data is being sent and page isn't redirected). It needs to be simple (no database). Is this possible with UE?

Sign in to reply to this post

Jason ByrnesWebAssist

you should leave it to use the post instead of get.


add the following code at line 1 of the page:

php:
<?php

if(!session_id()) session_start();
if(
$_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        
$_SESSION[$key] = $val;    
    }
}
?>




this will store the posted elements into session variables of the same name.

On the thank you page, instead of echoing the post:

php:
<?php echo((isset($_POST["textfield"]))?$_POST["textfield"]:""?>



use the session:

php:
<?php echo((isset($_SESSION["textfield"]))?$_SESSION["textfield"]:""?>
Sign in to reply to this post

jcrockett300688

Works...with small addition

Didn't work until the top of the thank-you page included:

<?php
session_start();
?>

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

Sign in to reply to this post

Web Studio West

Placing the code at the top of the page didn't work for me. I modified the code further down the page and it works properly.

Original Universal Email Code:

<?php
if (!isset($_SESSION))session_start();
if (($_SERVER["REQUEST_METHOD"] == "POST")) {
//WA Universal Email object="mail"



Modified Code:

<?php
if (!isset($_SESSION))session_start();
if (($_SERVER["REQUEST_METHOD"] == "POST")) {
foreach($_POST as $key => $val) {
$_SESSION[$key] = $val;
}
//WA Universal Email object="mail"
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...