0
如何更改此表单的动作?目前,它的帖子到index.php文件(我使用php-form-builder-class) 我使用了一个switch语句中的index.php如下:更改表单的动作
switch ($_GET['action'])
{
case 'new':
require_once USER_ROOT . 'new_thread.php';
echo "We are in user new";
break;
default:
echo "Hello";
}
所以在SITE /用户/动作=新的(或用户/ index.php?action = new)表单显示出来。我希望表单提交本身,而不是index.php的(即行动=“”)
形式如下(new_thread.php):
$form = new form("new_thread_form");
$form->setAttributes(array(
"width" => 400,
"jsIncludesPath" => "/lib/php-form-builder-class/includes"
));
if($form->validate()) {
echo "Your form has validated";
}
else {
echo "It has not validated";
}
$form->addHidden("cmd", "submit_0");
$form->addTextbox("Title:", "thread_title", "", array("required" => 1));
$form->addTextarea("Content:", "thread_content", "", array("required" => 1));
$form->addTextbox("Tags:", "thread_tags", "", array("required" => 1));
$form->addButton();
$form->render();
该类的文档相当吸引人。也许你可以在初始的setAttributes()调用中添加一个'action'参数。 – 2011-02-10 14:11:15