html file: <html> <head></head> <body> <form method="post" action="message.php"> <input type="button" name="press1" value="send this"> <input type="button" name="press2" value="send that"> </form> </body> </html> php file (message.php): <?php if (($_POST['press1'] == "send this") && ($_post['press2'] == "")){ $input = "you pressed send this button"; }elseif (($_POST['press2'] == "send that") && ($_post['press1'] == "")){ $input = "you pressed send that button"; } echo "$input"; ?>
It would be great to know what you're trying to do. Why do you check for an empty input in your statements? The value is the same in both cases. You should check "if ( isset($_POST['press1']) )" or "if ( isset($_POST['press2']) )". But... Please note, <input type="button" defines a clickable button that doesn't do anything. It's most often used to activate a JavaScript.
change your input type="button" from input type="submit" then it will work for example from <input type="button" name="press1" value="send this"> <input type="button" name="press2" value="send that"> to <input type="submit" name="press1" value="send this"> <input type="submit" name="press2" value="send that"> thanks