I have two files:
index.php
/lib/user.php
Index contains the form:
<div class="<? echo $msgclass; ?>">
<? echo $msg; ?>
</div>
<form id="signin" action="/lib/user.php" method="post">
...
</form>
User.php makes all the processing.
It sets $msg to ‘some error message’ and $msgalert to ‘error’ in case of any error. At the end of processing it uses header() to redirect to index.php
But after redirection $msg and $msgalert no longer persist and index only gets empty vars.
How can i fix this?
Edit: sorry misread your question. You can store those values in a session.
In
/lib/user.phpin
index.phpnote that
session_start()uses headers so it must be put before any output is sent.