0
<form action="service.php" method="POST">
            <fieldset>
                <input type="button" name="getMa" onclick="window.open('service.php')"value="MA anzeigen"/>
                <input type="text" size="5" maxlength="5" name="MA_ID" value=""/><br><br>
            </fieldset>

service.php:

if(isset($_POST['getMa']))
    {
        echo "getMa gedrückt";
    }

I just want to know which of my buttons has been pushed, what am I doing wrong? Any help appreciated, I'm new to this stuff, thx guys Regards Ismir

9
  • 4
    Show more of your form.html + service.php Commented Jan 7, 2016 at 8:04
  • 3
    which method are you set in form GET or POST? Commented Jan 7, 2016 at 8:04
  • 1
    At least button should have a value also Commented Jan 7, 2016 at 8:07
  • 2
    Try to scan by print "<pre>"; print_r($_POST); print "</pre>"; Commented Jan 7, 2016 at 8:07
  • 1
    If it's not a typo - add a space before value="" Commented Jan 7, 2016 at 8:08

1 Answer 1

3

Remove onclick="window.open('service.php')", the action attribute will submit the form. You are basically opening a window directly so it will not be having any information about the POST parameters

and yes change

 type="button"

to

 type="submit"
Sign up to request clarification or add additional context in comments.

3 Comments

I removed onclick, but then nothing happens, means service.php will not be opened, regard I have three buttons in this form
type="button" to type="submit"
This worked for me, thk u very much, I check this hook as soon as I'm able to ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.