发送此表单时,我看到'提交的表单无效。再试一次提交。'错误和输入未更新。
action =''没关系。请看重要的部分,php代码的中间,我找不到这个区域的问题。
<!-- INCLUDE overall_header.html -->
<form id="wideoptions" action='' method='post'>
<input type="wide_main" id="wide_main" name="config[wide_main]" size="30" value="{WIDE_MAIN}" />
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
</form>
PHP:
<?php
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
page_header('Wide Options');
$template->set_filenames(array(
'body' => 'wide_options.html',
));
//重要部分在这里
if (isset($_POST['submit']))
{
if (!check_form_key('acp_widecpanel'))
{
trigger_error('FORM_INVALID');
}
// request_var should be '' as it is a string ("1, 2, 3928") here, not an integer.
set_config('wide_main', request_var('wide_main', '0'));
trigger_error($user->lang['RT_SAVED'] . adm_back_link($this->u_action));
}
$template->assign_vars(array(
'WIDE_MAIN' => $config['wide_main'],
));
page_footer();
?>
答案 0 :(得分:0)
表单的名称必须与add_form_key中使用的名称匹配。你是否在表单创建过程中使用了add_form_key?