We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,868 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Problem displaying sessions

I have literally been banging my head on my keyboard out of frustration. I'm trying to display PHP sessions as values in my php form, but it's not going so well. here's what I have:

<?php session_start();?><html>
<head>
<title>Create An Event</title>
<style>
label {float: left; width: 100px;}
input[type=text],textarea {width: 210px;}
</style>
</head>
<body>
<form enctype="multipart/form-data" action="" method="post">
	<p><label for="name">Event Name</label><input type="text" name="name" value="<?php echo $_SESSION['name'];?>" /></p>
	<p><label for="description">Event Description</label><textarea name="description"><?php echo $_SESSION['description'];?></textarea></p>
	<p><label for="location">Location</label><input type="text" name="location" value="<?php echo $_SESSION['where'];?>"></input></p>
	<p><label for="">Start Time</label><input type="text" name="start_time" value="<?php echo $_SESSION['begin'];?>"></input></p>
	<p><label for="end_time">End Time</label><input type="text" name="end_time" value="<?php echo $_SESSION['end'];?>"></input></p>
	<p><input type="submit" value="Create Event" /></p>
</form>
</body>
</html>

php.ini is setup correctly and sessions are showing when I run

<?php session_start(); 
 Print_r ($_SESSION);
 ?>

Help would be appreciated thanks :D

3
Contributors
4
Replies
4 Days
Discussion Span
1 Year Ago
Last Updated
5
Views
waveydaveywaves
Newbie Poster
15 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Try dumping $_SESSION just before the <form> tag. Make sure $_SESSION array has data when comes to this page.

...
...
<body>
   <?php
       var_dump($_SESSION);
   ?>
   <form enctype="multipart/form-data" action="" method="post">
   ...
...
niranga
Junior Poster
192 posts since Apr 2010
Reputation Points: 21
Solved Threads: 26
Skill Endorsements: 0

Nope, Nothing dumping. I just don't get it.

waveydaveywaves
Newbie Poster
15 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

So that means you haven't set any session variables. Isn't it?

niranga
Junior Poster
192 posts since Apr 2010
Reputation Points: 21
Solved Threads: 26
Skill Endorsements: 0

Have you got cookies disabled?

diafol
Keep Smiling
Moderator
10,644 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,509
Skill Endorsements: 57

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0668 seconds using 2.69MB