nblackwood Posted September 6, 2009 Share Posted September 6, 2009 I am creating a multi-step registration process, and am having some issues. I am aware one way to accomplish this is the sessions. I am still learning php and am not very familiar with how to accomplish this, and google searches aren't helping much. I would like to know how to create the sessions to tore the information, and also recall the stored values for mysql injection after payment is verified. I am somewhat familiar with basic syntax. Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/173296-passing-data-from-one-form-to-another/ Share on other sites More sharing options...
sKunKbad Posted September 6, 2009 Share Posted September 6, 2009 I am creating a multi-step registration process, and am having some issues. I am aware one way to accomplish this is the sessions. I am still learning php and am not very familiar with how to accomplish this, and google searches aren't helping much. I would like to know how to create the sessions to tore the information, and also recall the stored values for mysql injection after payment is verified. I am somewhat familiar with basic syntax. Any help is appreciated. You start the session on any page that requires storing or retrieving data from the session: <?php session_start(); You can then use the $_SESSION array for whatever you need. <?php //store data $_SESSION['my_key'] = 'my_value'; //retrieve data $data = $_SESSION['my_key'] ; //delete unset($_SESSION['my_key']); This $_SESSION array is saved on the server, and the cookie that is put in the user's browser identifies them to use the session that belongs to them. If the user doesn't have cookies enabled, then there is sometimes a fallback to the session ID being placed in the URL, but this isn't the best thing to do. Quote Link to comment https://forums.phpfreaks.com/topic/173296-passing-data-from-one-form-to-another/#findComment-913458 Share on other sites More sharing options...
Jnerocorp Posted September 6, 2009 Share Posted September 6, 2009 I suck with sessions so what i do is when doing a multi step form is i save the data from each step into a hidden input . here is an example of a multi-step form http://jnerocorp.com/tests/find.php if this is what u are looking for I will help you set it up Quote Link to comment https://forums.phpfreaks.com/topic/173296-passing-data-from-one-form-to-another/#findComment-913462 Share on other sites More sharing options...
Rommeo Posted September 6, 2009 Share Posted September 6, 2009 Basically sessisons ; Usage ; <?php // file1.php session_start(); // FIRST LINE should be this . . . $_SESSION['color']='red'; ?> Then ; <?php // file2.php let's say session_start(); // again FIRST LINE should be this where ever you will use session. . // codes and stuff.. . . echo $_SESSION['color']; ?> So this will print ; red That's how you store information and use it. Also for to destroy the data in the sessions; <?php unset($_SESSION['color']); ?> Quote Link to comment https://forums.phpfreaks.com/topic/173296-passing-data-from-one-form-to-another/#findComment-913465 Share on other sites More sharing options...
sKunKbad Posted September 6, 2009 Share Posted September 6, 2009 Without even trying to understand the dynamics of how sessions work in php, all you have to know is that there is an array which you can store data, and that array is $_SESSION. This array is available to you anytime session_start() is placed before any output to the browser. If you don't know how to work with arrays, your chances of using sessions are limited at best. Quote Link to comment https://forums.phpfreaks.com/topic/173296-passing-data-from-one-form-to-another/#findComment-913681 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.