Cześć, dopiero się uczę i mam problem z wyświetleniem $msg. Chce by $msg było wyświetlane w index.php po kliknięciu w submit i sprawdzeniu (w osobnym pliku register.php) czy jest email poprawny lub nie
posiadam plik index.php
<?php
include 'core/int.php'; // zawiera $msg = ' '; oraz $db
include 'includes/overall/header.php'; // header, content
echo $msg;
?>
<?php include 'includes/overall/footer.php'; ?> // footer
plik 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 = 'poprawny email'; }
else {
$msg = 'niepoprawny email';
}
?>