我有index.php和register.php,concent.php文件。我想index.php顯示$味精(成功/錯誤),當我點擊按鈕,並檢查電子郵件是否正確。如何顯示來自register.php的回顯到index.php
的index.php
<?php
include 'core/int.php'; // $msg = ' ';
include 'includes/overall/header.php'; // header
include 'includes/overall/content.php'; // content
echo $msg; // HOW TO DISPLAY SUCCESS OR ERROR??
include 'includes/overall/footer.php'; ?>
content.php
<form action="register.php" method="post">
<input type="text" name="email" class="input" placeholder="Address email">  
<input type="text" name="email_r" class="input" placeholder="Reply address">   <input type="submit" name="register" class="button button-primary" value="REGISTER">
<aside class="log_reg3">
<input type="checkbox" name="tems" value="tems"> I Accept TEMS  
<a href="?register">Register</a>   Forgotten your <a href="recover.php?mode=username">username</a> and <a href="recover.php?mode=password">password</a>
</aside>
register.php
<?php include 'core/int.php'; // $db, $msg
if(!empty($_POST['email']) && isset($_POST['email']) && !empty($_POST['email_r']) && isset($_POST['email_r'])) {
$email=($_POST['email']);
$email_r=($_POST['email_r']);
$regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/';
if(preg_match($regex, $email)) {
$msg = 'success'; }
else {
$msg = 'error';
}}?>
你只是在尋找'$ _SESSION'來在一頁上設置一個值然後在下一個頁面上顯示它? – David