Probably! If the form doesn't work, try changing the action to the name of the current page?
Unfortunately, this is meant to work with
my explore system, not one by other users... It should be easily modified, though? I haven't tried using other people's since mine fits my needs. (I'd rather only have on page, than have to make a new page for each zone.)
And um...yeah, some of that stuff isn't quite right in right order, hang on...
PHP Code:
//Normal page stuff
$document->add(new Comment("Lalala we're exploring.", FALSE));
//Call the function that'll add the button to pick up a cat
$this->pickupPet("Fleet");
//This function generates the form
public function pickupPet($species){
$document = $this->document;
$document->add(new Comment("
<form id='pickup_pet' action='explore' name='pickup_pet' method='post' role='form'>
<input id='pet_found' name='pet_found' type='hidden' value='{$species}'>
<button id='acquire' value='species' name='acquire' type='submit'>
<center>Pick up this {$species}?</center>
</button>
</form>
", FALSE));
return;
}
//When the page loads it'll check if there's post data
if($mysidia->input->post("pet_found")){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$species = $mysidia->input->post("pet_found");
$this->givePet($species);
$document->setTitle("Kitten Acquired!");
$document->add(new Comment("You've collected a new {$species}!"));
/* Might want to add a link here to continue exploring or go elsewhere? */
}
// This function is called in the function that only works if there's post data
public function givePet($species){
$mysidia = Registry::get("mysidia");
$newadopt = new StockAdopt($species);
$newadopt->append($mysidia->user->username);
return;
}
To fix it up any better than that, I'd have to see and test the whole page. @w@'