Hi, here is the problem, I have two buttons in a form named 'Submit' and 'Preview', code as follows:
<form method="POST" action="post">
Name: <input type="text" name="name" size="20"><br>
Email: <input type="text" name="email" size="20"><br>
Message: <textarea name="message" height="5" width="80"></textarea><br>
<input type="submit" value="Submit">
<input type="submit" value="Preview">
</form>
I want to have my next script to recognize two different actions "submit" and "preview", but I don't want to do the following:
.................
<input type="submit" name="action" value="Submit">
<input type="submit" name="action" value="Preview">
because I allow my users to modify the template, thus, the buttons' name too, so my script won't recoginze the value if
// what if button's value change to "Sent" or other language, this script won't work.
if ($_POST['action'] == "Submit") {
// .....
}
if ($_POST['action'] == "Preview") {
// ....
}
Any ideas, thanks:rolleyes: