Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Buttons with different actions? (http://www.mysidiaadoptables.com/forum/showthread.php?t=5284)

Dinocanid 12-05-2016 03:20 PM

Buttons with different actions?
 
I'm pretty confused on how to use buttons. I know how to make them appear but I don't know how to make them do anything. I know I could use code similar to the many forms around the site like so:
PHP Code:

if($mysidia->input->post("submit")){
            
$document->setTitle($this->lang->rename_success_title);
            
$document->add($image);
            
$message "<br>{$this->lang->rename_success}{$mysidia->input->post("adoptname")}
                        You can now manage 
{$mysidia->input->post("adoptname")} on the";
            
$document->addLangvar($message);
            
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}""My Adopts Page"));
            
$adopt->setHealth($addHealth"update");
                        if (
$health 100){$adopt->setHealth(100"update");
            
$document->add(new Comment("<br></br>{$adopt->getName()} has full health!"));
            }
            
            return;
        }
        
        
$document->setTitle($this->lang->rename.$adopt->getName());
        
$document->add($image);
        
$document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />");
        
        
$renameForm = new FormBuilder("renameform""""post");
        
$renameForm->buildTextField("adoptname")->buildButton("Rename Adopt""submit""submit");
        
$document->add($renameForm); 

(The health part was from me testing my health mod btw, so you can ignore that part)
But what if I wanted two buttons on the same page that do different things when clicked? For example, I want to have two different buttons, one that lowers a value when clicked and another that raises a value. Would I have to have two forms?

EDIT: I figured it out. I had to use two forms


All times are GMT -5. The time now is 09:22 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.