html - How I can pass user input between php files? -
now have simple email login form
<form action="one.php"> <input type="email" name="email"/> </form>
one.php email filter gmail users , header them custom path
<?php $email = $_post['email']; if (stripos($email, '@gmail.com') !== false) { header('location: ../gmail/index.html'); } else { header('location: /unknownusers'); } ?>
now done first page question how can email name page' example in /gmailusers
<html> <head> </head> <body> <div> <font>welcome back,</font> <?php include 'one.php'; echo $email; ?> </div> </body></html>
$email not work in because one.php doesn't have saved info
how can make this
welcome 'user.email@gmail.com'
in index.html file
can body me php code.
the easiest way not use location
redirection, include file want show.
one.php
<?php $email = $_post['email']; if (stripos($email, '@gmail.com') !== false) { include "gmail.php"; } else { header('location: /unknownusers'); }
gmail.php
(this file replace gmail/index.html because server configurations won't pass .html files php processor.)
<html> <head> </head> <body> <div> <font>welcome back, <?php echo $email; ?></font> </div> </body></html>
in case, one.php shows gmail user gmail.php dictates, , redirects other users unknownusers page.
if want 'login' persistent (so server remembers person is), you'll need session.
Comments
Post a Comment