I have a web form (form.php) in PHP which has following layout:
<form method="post" action="mailer.php" class="form-horizontal">
mailer.php has a function that checks for data, validates it and send email to me. After this all is done successfully I want to redirect to my form page with an alert/info message.
Mailer function in mailer.php looks like:
$httpReferer = $_SERVER['HTTP_REFERER'];
print_r("Form submitted successfully. We will contact you soon !");
header('Location: '. $httpReferer) ;
I want to get the message in print_r on form.php in the following div,
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Make sure to fill all the fields with correct values before sending your email!
</div>
I am able to redirect back, but without any message. Tried echo, tried using JavaScript alerts etc. None worked for me.
print_randdivdeserved backticks, so I made the other changes too.