Jump to content

$_SESSION Variables not resetting


The14thGOD

Recommended Posts

Basically I am using PHP to validate a form and if the user has to go back it makes a bunch of $_SESSION variables and stores what the user put in.

Now it stores it and repopulates the form correctly the 1st time. However, if I go in and change things and still "make a mistake" it keeps the old data. It doesn't overwrite.

IE If I had a name field and changed it from John to Joe it would stay as John when it comes back saying I missed something yet again.

Here's the code that I'm using to set and overwrite the variables (they're more variables but its the same thing so I took them out)

<?php
import_request_variables('pg');
if($format == 1) {
//stuff
}else {
	session_start();
	$_SESSION['category'] = $category;
	$_SESSION['format'] = $format;
	$_SESSION['homepage'] = $homepage;
	header("Location: index.php?error=format");
	exit(0);
}
?>

Basically if I dont enter anything into format it shoots back telling me I have to select something for format. So if I miss something again and I ended up changing a bunch of things, it doesnt change. It keeps the old values I put in.

This may not be the most efficient way but it's the quickest way I know (on a budget). It works on my server for my website but doesn't work on this server Im testing on.

Is there a global php setting that I need to enable/set?

Thanks for any and all help,

 

Justin

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.