Я не могу получить данные формы сообщения из скрипта CodeIgniter - PullRequest
0 голосов
/ 02 ноября 2018

Я прочитал все посты по этой теме, которые нашел, и мне кажется, что ничего не помогает. Раньше он работал на предыдущем хосте, а не на этом новом. У меня такое ощущение, что это может быть проблема .htaccess. Сайт находится в собственном поддомене. http://test.domain.com

routes.php:

$route['default_controller'] = "calculator";
$route['404_override'] = '';

некоторые формы:

<form action="index.php/calculator/calculate" method="post" id="calc_form" enctype="multipart/form-data;charset=utf-8">    
<input name="span_length_ft" id="span_length_ft" type="text"/>ft
<input name="span_length_in" id="span_length_in" type="text"/>Inch

Контроллеры / calculator.php

class Calculator extends CI_Controller {


public function __construct()
{
    parent::__construct();

    $this->load->model('products_model');
    $this->load->helper('form');

}

public function index(){

    $deck_filters = $this->products_model->get_filters(FILTER_TYPE_DECK);
    $sup_att_filters = $this->products_model->get_filters(FILTER_TYPE_SUP_ATT);
    $side_att_filters = $this->products_model->get_filters(FILTER_TYPE_SIDE_ATT); 
    $gage_filters = $this->products_model->get_gages();
    $sup_pattern_filters = $this->products_model->get_distinct_sup_patterns();
    $side_spacing_filters = $this->products_model->get_distinct_side_spacings(); 
    $thick_filters = array(
    1 => '< 1/8"',
    2 => '1/8"',
    3 => '3/16"',
    4 => '1/4"',
    5 => '5/16"',
    6 => '3/8"',
    7 => '> 3/8"'
    );

    $this->load->view('header');
    $this->load->view('calculator',array(
    'deck_filters' => $deck_filters,
    'sup_att_filters' => $sup_att_filters,
    'side_att_filters' => $side_att_filters,
    'gage_filters' => $gage_filters,
    'sup_pattern_filters' => $sup_pattern_filters,
    'side_spacing_filters' => $side_spacing_filters,
    'thick_filters' => $thick_filters
    ));
    $this->load->view('footer');
}

public function calculate(){

    $this->load->library('form_validation');
    $this->load->model('products_model');
    $this->load->helper(array('form','url'));
    $this->output->set_header("Pragma: no-cache");

var_dump($this->input->post());
var_dump($_POST);

    if($this->_val_params()){

        $span_length_ft = $this->input->post('span_length_ft',TRUE);
        $span_length_in = $this->input->post('span_length_in',TRUE);
        $nr_spans = $this->input->post('nr_spans',TRUE);
        $req_shear = $this->input->post('req_shear',TRUE);
        $max_flex = $this->input->post('max_flex',TRUE);
        $req_vload = $this->input->post('req_vload',TRUE);
        $labor_rate = $this->input->post('labor_rate',TRUE);
etc.. etc..
}
private function _val_params(){
    $rules = array( 
    array(
    'field'   => 'span_length_ft',
    'label'   => 'Span Length (ft)',
    'rules'   => 'trim|xss_clean|required|integer|callback_check_span_length'
    ),
    array(
    'field'   => 'span_length_in',
    'label'   => 'Span Length (In)',
    'rules'   => 'trim|xss_clean|integer'
    ),
    array(
    'field'   => 'nr_spans',
    'label'   => 'Number of Spans',
    'rules'   => 'trim|xss_clean|required|integer'
    ),
    array(
    'field'   => 'req_shear',
    'label'   => 'Required Diaphragm Shear',
    'rules'   => 'trim|xss_clean|required|numeric'
    ),
    array(
    'field'   => 'max_flex',
    'label'   => 'Maximum Flexibility Factor',
    'rules'   => 'trim|xss_clean|numeric'
    ),
    array(
    'field'   => 'req_vload',
    'label'   => 'Maximum Flexibility Factor',
    'rules'   => 'trim|xss_clean|numeric'
    ),
    array(
    'field'   => 'labor_rate',
    'label'   => 'Labor Rate',
    'rules'   => 'trim|xss_clean|required|numeric'
    ),

    array(
    'field'   => 'filter_deck[]',
    'label'   => 'Deck filter',
    'rules'   => 'trim|xss_clean|integer'
    ),

    array(
    'field'   => 'filter_gage[]',
    'label'   => 'Gage filter',
    'rules'   => 'trim|xss_clean|integer'
    ),

    array(
    'field'   => 'filter_sup_att[]',
    'label'   => 'Support Attachment filter',
    'rules'   => 'trim|xss_clean|integer'
    ),

    array(
    'field'   => 'filter_sup_pattern[]',
    'label'   => 'Support Attachment Pattern filter',
    'rules'   => 'trim|xss_clean|max_length[5]'
    ),

    array(
    'field'   => 'filter_thick[]',
    'label'   => 'Support Thickness filter',
    'rules'   => 'trim|xss_clean|integer'
    ),

    array(
    'field'   => 'filter_side_att[]',
    'label'   => 'Sidelap Attachment filter',
    'rules'   => 'trim|xss_clean|integer'
    ),

    array(
    'field'   => 'filter_side_spacing[]',
    'label'   => 'Sidelap Attachment Spacing filter',
    'rules'   => 'trim|xss_clean|integer'
    )
    );

    $this->form_validation->set_rules($rules);

    return $this->form_validation->run();
}

.htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
...