simple question !

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm a newbie, and struggling a bit ! I've spent about 3 days trying to
solve a simple problem, and I've failed.

I have a screen, with two buttons.
When the user hits either button, a php function (or procedure) should
get called, and the php code needs to programatically work out which
button is pressed. Sounds simple. But I just don't know how to do it. I
have looked at manuals etc, and tried various things, but I just cant
find out the construct

If someone could post a tiny code sample, would be fantasic and much


Re: simple question !

Quoted text here. Click to load it

I'm still pretty much learning myself, but this is one way.  Let me know if  
this helps.


$content = "<form name='form1' method='post' action=''>
   <input type='submit' name='submit1' value='Submit'>
   <form name='form2' method='post' action=''>
     <input type='submit' name='submit2' value='Submit'>
print $content;
if (isset($_POST['submit1'])) { //First submit button clicked
 print "The first button was clicked";
elseif (isset($_POST['submit2'])) { //Second submit button clicked
 print "The second button was clicked";

//print_r($_POST); //Used for Debugging

Re: simple question !

The two buttons don't have to be in different forms

Re: simple question !


Your example is great,  just what I need.  Cheers for your help


Site Timeline