简体   繁体   中英

codeigniter form not submitting fields

I'm a newbie for codeigniter. I'm stuck at a problem, that my form is not posting values, I dont know why. Current site works fine on local server and my testing server. As I transferred complete site on clients server, this problem occurred.

I have checked, htaccess is enabled. I'm also pasting my view, and controller. Please help me

VIEW

<form name="form1" method="post" action="index.php/search/make_url">
    <div class="search_form">

        <label for="shop"></label>
        <select name="category" id="select">
          <option value="0">-- Shops / Webshops --</option>
          <?php 
            $cats=load_categories();
            foreach($cats as $cat){
          ?>
            <option value="<?php echo $cat->cat_name_en."---".$cat->catId;?>"><?php echo $cat->cat_name_en;?></option>
          <?php }?>
        </select>
        <select name="product">
          <option value="0">-- <?php echo $this->lang->line("text_select_prod");?> --</option>
          <?php 
            $cats=load_products();
            foreach($cats as $cat){
          ?>
          <option value="<?php echo $cat->p_name_en;?>---<?php echo $cat->pId;?>"><?php echo $cat->p_name_en;?></option>
          <?php }?>
        </select>
        <label for="select2"></label>
        <select name="brand" id="brand">
          <option value="0">-- <?php echo $this->lang->line("text_select_chose_brand");?> --</option>
          <?php 
            $cats=load_brands();
            foreach($cats as $cat){
          ?>
          <option value="<?php echo $cat->brand_name_en;?>---<?php echo $cat->brandId;?>"><?php echo $cat->brand_name_en;?></option>
          <?php }?>
        </select>
        <label for="select3"></label>
        <select name="country" id="country"  onchange="getCity(this.value);">
          <option value="0">-- <?php echo $this->lang->line("text_select_country");?> ---</option>
          <?php 
            $cats=load_country();
            foreach($cats as $cat){
          ?>
          <option value="<?php echo $cat->cn_name;?>---<?php echo $cat->cnId;?>"><?php echo $cat->cn_name;?></option>
          <?php }?>
        </select>
        <label for="select4"></label>
        <div id="cityBlock">
        <select name="city" id="city">
          <option value="0">-- <?php echo $this->lang->line("text_select_city");?> --</option>
        </select>
        </div>
        <input type="submit" name="btn" value="<?php echo $this->lang->line("text_btn_submit");?>">

    </div>
    </form>

CONTROLLER

public function make_url()
{
    $url=$this->uri->assoc_to_uri($_POST);
    redirect(base_url()."index.php/search/for/". $url);
}

Thanks in advance

Check out this way:

<?=form_open('immovable/personal/add_personal');?>
<input type='text' id='fname' name='fname' required />
<input type='text' id='lname' name='lname' required />
<input type='submit' value='Submit' />
<?=form_close()?>

$config[suffix] is the solution for the above problem

Refer this link for better explanation

I solved this problem later. Problem was base tag used in Head tag . I simply removed it, and website was functional.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM