Remember when you FIRST enter the page, there is no such thing about the variable $do since $_POST array does not exist!
I see multiple problems over there.
- Your form has the method of POST, so why do you use GET ?
+ $do=$_GET['do']; should be $do=$_POST['do'];
- Now since the variable do does not exist you could do a simple if statement that checks that. The function isset checks if that variable exists.
+ $do = isset($_POST['do']) ? 'send' : 'ok';
- But there is another problem, The hidden name for do does not exist.. So lets change it to do
+
[now the overall code]
=============================
// Lets just display the current Action
echo 'ACTION:'.$do;
// Check if the hidden variable was sent
if ($do == 'send') {
// Lets print out the post array
var_dump($_POST);
} else { ?>
=============================
I took out the other forms...
The above should work.. Now.. But why introduce another variable if you already have the submit variable intact? What you could do is say $do = isset($_POST['submit']) ? 'send' : 'Submit'; That will remove that hidden field. Another thing I realize is that your mixing HTML code with PHP code which is BAD PRACTICE. I recommend you to at least separate them, or if you don't want to use a templating engine, I recommend you do at least store the output in one variable like outvar = "". That will take out alot of issues in the future.