我在codeigntier中研究过不允许的关键字符错误。但是,我认为我的形式中没有这些角色。可能是我可能弄错了。
我的表格
<div class="container_part">
<div class="container">
<div class="row-fluid maincontainer">
<div class="mycontainer">
<?php echo form_open('bookings/customerdetails'); ?>
<div class="row-fluid">
<div class="span12 mainheading">
<hr>
</div>
<div class="row-fluid">
<div class="span6">
<div style="padding: 20px;">
<div>
<select name="booking_form_customer_initial">
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option>
</select>
</div>
<div>
<input type="text" name="booking_form_customer_name" placeholder="Enter Full Name" class="span12" required="required" />
</div>
<div>
<input type="text" name="booking_form_customer_phone" placeholder="Enter Phone Number" class="span12" required="required" />
</div>
<div>
<input type="email" name="booking_form_customer_email" placeholder="Enter Email" class="span12" required="required" />
</div>
</div>
</div>
<div class="span6">
<div class="control-group select optional booking_form_pick_up_method">
<label class="select optional control-label" for="booking_form_pick_up_method">Delivery method</label>
<div class="controls">
<select class="select optional form-refesher" id="booking_form_pick_up_method" name="booking_form_pick_up_method" required="required">
<option value="">Select Delivery method</option>
<option value="in_store">self_pick_up</option>
<option value="courier">courier</option>
</select>
</div>
</div>
<div data-observe="#booking_form_pick_up_method" data-visible-when="in_store" style="display: none">
<div class="control-group select optional booking_form_pick_up_location">
<label class="select optional control-label" for="booking_form_pick_up_location">Pick up location</label>
<div class="controls">
<select class="select optional form-refesher" id="booking_form_pick_up_location" name="booking_form[pick_up_location]">
<option value="1">Tsim Sha Tsui</option>
</select>
</div>
</div>
</div>
<div data-observe="#booking_form_pick_up_method" data-visible-when="courier" style="display: none">
<div class="control-group string optional booking_form_pick_up_courier_name">
<label class="string optional control-label" for="booking_form_pick_up_courier_name">Contact Person</label>
<div class="controls">
<input class="string optional" id="booking_form_pick_up_courier_name" name="booking_form[pick_up_courier_name]" type="text" value="" />
</div>
</div>
<div class="control-group string optional booking_form_pick_up_courier_addr">
<label class="string optional control-label" for="booking_form_pick_up_courier_addr">Delivery Address</label>
<div class="controls">
<input class="string optional" id="booking_form_pick_up_courier_addr" name="booking_form[pick_up_courier_addr]" type="text" value="" />
</div>
</div>
<div class="control-group tel optional booking_form_pick_up_courier_phone">
<label class="tel optional control-label" for="booking_form_pick_up_courier_phone">Contact Phone</label>
<div class="controls">
<input class="string tel optional" id="booking_form_pick_up_courier_phone" name="booking_form[pick_up_courier_phone]" type="tel" value="" />
</div>
</div>
</div>
<div class="control-group select optional booking_form_drop_off_method">
<label class="select optional control-label" for="booking_form_drop_off_method">Return Method</label>
<div class="controls">
<select class="select optional form-refesher" id="booking_form_drop_off_method" name="booking_form_drop_off_method" required="required">
<option value="">Select Return method</option>
<option value="in_store">self_drop_off</option>
<option value="courier">courier</option>
</select>
</div>
</div>
<div data-observe="#booking_form_drop_off_method" data-visible-when="in_store" style="display: none">
<div class="control-group select optional booking_form_drop_off_location">
<label class="select optional control-label" for="booking_form_drop_off_location">Drop off location</label>
<div class="controls">
<select class="select optional form-refesher" id="booking_form_drop_off_location" name="booking_form[drop_off_location]">
<option value=""></option>
<option value="1">Tsim Sha Tsui</option>
</select>
</div>
</div>
</div>
<div data-observe="#booking_form_drop_off_method" data-visible-when="courier" style="display: none">
<div class="control-group string optional booking_form_drop_off_courier_name">
<label class="string optional control-label" for="booking_form_drop_off_courier_name">Contact Person</label>
<div class="controls">
<input class="string optional" id="booking_form_drop_off_courier_name" name="booking_form[drop_off_courier_name]" type="text" value="" />
</div>
</div>
<div class="control-group string optional booking_form_drop_off_courier_addr">
<label class="string optional control-label" for="booking_form_drop_off_courier_addr">Return Address</label>
<div class="controls">
<input class="string optional" id="booking_form_drop_off_courier_addr" name="booking_form[drop_off_courier_addr]" type="text" value="" />
</div>
</div>
<div class="control-group tel optional booking_form_drop_off_courier_phone">
<label class="tel optional control-label" for="booking_form_drop_off_courier_phone">Contact Phone</label>
<div class="controls">
<input class="string tel optional" id="booking_form_drop_off_courier_phone" name="booking_form[drop_off_courier_phone]" type="tel" value="" />
</div>
</div>
</div>
<div>
<div>
Customer Remarks
</div>
<div class="control-group string optional booking_form_remarks">
<div class="controls">
<textarea class="string optional input-large span8" id="booking_form_remarks" name="booking_form_remarks]" ></textarea>
</div> </div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="clearfix"></div>
<div class="row-fluid" id="transaction-details" style="position: relative;">
<div style="padding:25px;">
<div id="cart_content">
<?php echo $this->view('shop/cart.php'); ?>
</div>
<input type="submit" name="customer_details_submit_btn" value="Next" class="btn btn-primary" />
</div>
</div>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div>
function customerdetails() {
$customer_v_rules = array(
array(
'field' => 'booking_form_customer_name',
'label' => 'Full Name',
'rules' => 'required'
),
array(
'field' => 'booking_form_customer_phone',
'label' => 'Phone',
'rules' => 'required'
),
array(
'field' => 'booking_form_customer_email',
'label' => 'Email',
'rules' => 'required|valid_email'
),
array(
'field' => 'booking_form_pick_up_method',
'label' => 'Delivery Method',
'rules' => 'required'
),
array(
'field' => 'booking_form_pick_up_method',
'label' => 'Delivery Method',
'rules' => 'required'
),
array(
'field' => 'booking_form_drop_off_method',
'label' => 'Return Method',
'rules' => 'required'
)
);
$this->form_validation->set_rules($customer_v_rules);
if ($this->form_validation->run()) {
$name = $this->input->$this->input->post('booking_form_customer_name');
$phone = $this->input->post('booking_form_customer_phone');
$email = $this->input->post('booking_form_customer_email');
$remarks = $this->input->post('booking_form_remarks');
echo 'OK';
} else {
$this->customer_details_initial_task();
//$this->show_products_session_array();
$data = array('page_title' => 'Customer Section');
$meta = array('page_title' => 'Customer Section');
$this->template->write_view('meta', 'templates/wiyo/partials/meta', $meta, TRUE);
$this->template->write_view('header', 'templates/wiyo/partials/header', $data, TRUE);
$this->template->write_view('content', 'customerdetails', $data, TRUE);
$this->template->render();
}
//$this -> output -> enable_profiler(TRUE);
}
我的配置文件
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['uri_allowed_chars'] = 'a-z?';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
<小时/> 非常感谢帮助。
答案 0 :(得分:3)
Step1。在/system/core/Input.php上搜索函数_clean_input_keys
Step2。修改此行:
exit(‘Disallowed Key Characters.’);
为:
exit(‘Disallowed Key Characters.’ . $str);
Step3。刷新页面以查看产生错误的字符
Step4。如果您需要将这些字符添加到例外列表中,只需添加到此行
if ( ! preg_match(“/^[a-z0-9:_\/-]+$|/i”, $str))
我在上面的示例中添加了|
(管道)字符。
答案 1 :(得分:0)
发现可能的问题。看看你的textarea的名字“]”必须是一个不允许的角色。
<textarea class="string optional input-large span8" id="booking_form_remarks" name="booking_form_remarks]" ></textarea>