Code: Select all
if user submitted form
header("script.php?message=$messagetext");Anyone willing to share some insight into possible alternatives?
Moderator: General Moderators
Code: Select all
if user submitted form
header("script.php?message=$messagetext");Code: Select all
<form action="e;process.php"e; method="e;post"e;>
Enter a number : <input type="e;text"e; name="e;the_number"e; />
<br />
<input type="e;submit"e; value="e;Submit"e; />
</form>
<br />
<?php
if (isset($_GETї'success'])) {
echo 'Thanks, your number has been submitted';
}
if (isset($_GETї'failure'])) {
echo 'no, I aksed you to enter a NUMBER';
}
?>Code: Select all
<?php
if (!empty($_POST)) {
if (isset($_POSTї'the_number'])) {
if (is_nan($_POSTї'the_number']) || $_POSTї'the_number'] == '') {
header ('location: Form.php?failure=1'); //Fail
} else {
//Process your data now!
header ('location: Form.php?success=1'); //Success
}
} else {
header ('location: Form.php?failure=1'); //Fail
}
} else {
echo 'This page is for form submissions only'; //Shouldn't be here
}
?>