3
Don't really get what your trying to do, but this is the working version of the script you posted above.
(I removed the template vars as they ain't needed for proper functioning of the script)
Version 1:
require('mainfile.php');
include($GLOBALS['xoops']->path('header.php'));
if(!empty($_GET["id"])){
$id = intval($_GET["id"]);
}elseif(!empty($_POST["id"])){
$id = intval($_POST["id"]);
}else{
// do something if no id is set
}
xoops_load('xoopsformloader');
$form = new XoopsThemeForm(_MI_SEND, "form1", "send.php");
$hidden_id = new XoopsFormHidden('id', $id);
$form->addElement($hidden_id);
$button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit");
$form->addElement($button_submit);
$form->display();
include($GLOBALS['xoops']->path('footer.php'));
?>
This version puts the form in the <{$form}> template var (If you realy wan't to work with templates
![](https://xoops.org/uploads/smil42e7a65fee35d.gif)
)
Version 2:
require('mainfile.php');
include($GLOBALS['xoops']->path('header.php'));
if(!empty($_GET["id"])){
$id = intval($_GET["id"]);
}elseif(!empty($_POST["id"])){
$id = intval($_POST["id"]);
}else{
// do something if no id is set
}
xoops_load('xoopsformloader');
$form = new XoopsThemeForm(_MI_SEND, "form1", "send.php");
$hidden_id = new XoopsFormHidden('id', $id);
$form->addElement($hidden_id);
$button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit");
$form->addElement($button_submit);
$xoopsTpl->assign('form', $form->display());
include($GLOBALS['xoops']->path('footer.php'));
?>
Hope this does what you want it to do and otherwise please try to explain what your trying to do...
Greets Dylian.