close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Session Variables Nightmare

Thread began 11/18/2010 8:15 am by Daryl | Last modified 11/22/2010 6:22 am by Daryl | 1554 views | 3 replies

DarylBeta Tester

Session Variables Nightmare

I am having a nightmare with session variables (again!)

I have tried using the native Dreamweaver Session Variable options to set a form field as a session variable and then on the next page to display it, with no luck.

I have also tried the ecart set session value also which I sometimes get to work.

I have created a single element form like this (using the ecart behaviour);

<?php
if (!session_id()) session_start();
if(($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) {
$_SESSION["sessiontest"] = "".((isset($_POST["sessiontest"]))?$_POST["sessiontest"]:"") ."";
}
?>
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body><form action="thankyou_pdf.php" method="post">
<p>
<input name="sessiontest" type="text" />
</p>
<p>
<input type="submit" name="test" id="test" value="Test" />
</p>
</form>
</body>
</html>



And then try and display it here;

<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php echo $_SESSION['sessiontest']; ?>
</body>
</html>



But I either get a blank page or a value that I had created in the form earlier in the day.

Can someone please tell me how to set a session variable from a form element using either a DW or Webassist behaviour and then show it on the next page?

Thanks in advance

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...