How to make a script that takes 2 form fields from page 1 and introduce them in page ? It is kind of login script, for example: Page 1: Login name: A Country: USA Button(to go to next page) Page 2: Login name: A Country: USA Name Age Etc... Note that pages are different and php. Thanks for future help Regards, Fluor
Starting a session would be the best choice here but if there's no need for the user to go back and forth, use POST method.
Can you give me an example of POST method, i don`t really understand how to do this Thanks for help! Regards, Fluor
Like: page1.html <form mehod='POST' action='page2.php'> <input type='text' name='username'> <input type='text' name='country'> ... <input type='submit' name='submitPage1'> </form> HTML: page2.php <?php if($_POST['submitPage1']) { $username = $_POST['username']; $country = $_POST['country']; ?> <b>Username:<b> <?=$username;?> <p> <b>Country:</b> <?=$country;?> <?php } ?> PHP: And if you need it to remain forever, you can make a session like $_SESSION['loggedin'] = TRUE; PHP: Once the user is loggedin or whatever needs to be remembered and then check it like: if($_SESSION['loggedin'] == TRUE) { //user loggedin //... } PHP:
You don't need to use sessions, it is actually better to use the $_GET['id''] functions and call the information from the url!, you can also encrypt the url code after it's all been gathered into 1 url display! Then use the $_GET functions on the next page to display the data in hidden fields or call it out if needed! then on submit process all the information! The best and secure way of doing this! You can also use .htaccess mod rewrite to even increase the security of the encoded url by not allowing it to be displayed at all. Reason this is a better secure way: Sessions are stored on to the users computer via a Session Cookie! Which can be high jacked from hackers etc. With the method above everything is done on your server and is as secure as your encryption is! Which things can be encrypted, in a un-reverse way. Making this the most secure method on doing this!