Jump to content

Need help with multiple submit buttons


TheWebExpert

Recommended Posts

I really need this particular form to have two separate submit buttons.  I have a listbox, on which I've selected the item in question.  With button1, I want to simply "check" or "uncheck" a box, and then redisplay the list.  With the other, I want to do other editing.  However, no matter how I do it (either same name, different values) or (different name, different values), I'm not seeing the buttons at all.

      <form action = "processedit.php" method = "post" style = "z-index: 1; width: 898px; height: 232px; position: absolute; top: 30px; left: -1px">
        <input type = "image" name = "sbutton" alt = "Submit" value = "Select"   id = "zz" ...
        <input type = "image" name = "abutton" alt = "Submit" value = "Activate" id = "qq" ...
        <input type = 'hidden' name = 'uname'  id = 'uname'  value = '<? echo $uname; ?>'/>
        <select name = "books" class = "auto-style1" value = '' size = "40" style = "width: 543px; height: 203px; z-index: 1; position: absolute; top: 11px; left: 15px">

...

if (isset($_POST['abutton'])) $func = $_POST['abutton'];
if (isset($_POST['sbutton'])) $func = $_POST['sbutton'];
 

Link to comment
Share on other sites

By the way, if you ever want a submit button with a value that's separate from the label - or want a button that is more than just text - then <button> exists to help you out:

<button type = "submit" name = "btnSub" value = "something"   id = "zz">Select</button>

where the btnSub value in $_POST will be "something".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.