The14thGOD Posted January 14, 2009 Share Posted January 14, 2009 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 Quote Link to comment Share on other sites More sharing options...
dawsba Posted January 14, 2009 Share Posted January 14, 2009 change the name of your session vars their prob overriding. ie $_SESSION['category_form'] = $category; $_SESSION['format_form'] = $format; $_SESSION['homepage_form'] = $homepage; Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 14, 2009 Share Posted January 14, 2009 That only happens if register_globals is enabled, which shouldn't be the case. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.