![]() |
Hy, I am trying to create page with many buttons. That when the button is pressed some text is send to the othe page. I can see that variable is storing data when I am showing the content in first page, but when I am movin to the other page is empty.
PHP Code: <?php PHP Code: This is code from the other page:
eee. Wrong code.
I have found solution: PHP Code: <div class="one" text-align: center;>
HI, I think one way to accomplish this is by trying PHP sessions: for example:
//page1.php <?php if(isset($_POST['submit'])) { session_start(); $_SESSION['name'] = $_POST['name']; $_SESSION['email'] = $_POST['email']; header('Location: page2.php'); } ?> <html> <head> <title>Page1</title> </head> <body> <form action="page1.php" method="POST"> <label>Name</label> <input type="text" name="name"><br> <label>Email</label> <input type="text" name="email"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html> -------------------------------------------------------------------------- //Page2.php <?php session_start(); $name = $_SESSION['name']; $email = $_SESSION['email']; ?> <html> <head> <title>Page2</title> </head> <body> <b>Name:</b> <?= $name; ?><br> <b>Email</b> <?= $email ?> </body> </html> ------------------------------------------------------- Also CodeIgniter's Session Library makes things much easier, please go through their docs. https://codeigniter.com/user_guide/libra...sions.html for more general help please check this link too: https://www.w3schools.com/PhP/php_sessions.asp Hope this helps. |
Welcome Guest, Not a member yet? Register Sign In |