0

In one of my views form action suddenly stopped working. When I click on submit page stays the same.But my other forms on same domain are working fine. Then what is the problem with this form?? I am doing this in codeigniter. So what might be the reason behind this??

 <form enctype="multipart/form-data" method="POST" action=<?php echo base_url()."index.php/controller_user/checker"; ?> > <table width="100%" border="0" > <tr> <td> <table> <tr> <td> <div id="prj" style="display: none;">Enter Project:-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="prname" required/> </div> <div id="project">Enter Project:-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <select class="prj_name" name="prj_name" id="prj_name" onchange="process(this.value)" tabindex="11" required> <option selected="selected">Select Project</option> <?php $sql = "SELECT * FROM project ORDER BY prj_id DESC"; $query = $this->db->query($sql); if ($query->num_rows() > 0){ foreach ($query->result() as $row){ $projectName= $row->prj_name; $projectID=$row->prj_id; echo '<option value="'.$projectID.'">'.$projectName.'</option>'; }//end of for loop echo '<option value="'.'0'.'">'.'New Project'.'</option>'; } ?> </select> </div> </td> </tr> <tr> <td> <input type="submit" name="submit" value="Submit"/> </td> </tr> </table> </form> 

This is my controller_user/checker

 function checker() { $projectname=$_POST['prj_name']; if($projectname=='0') { $config['upload_path'] = './uploads/'; $config['allowed_types'] = '*'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); $this->upload->do_upload('layout'); $data = $this->upload->data(); move_uploaded_file($_FILES["layout1"]["tmp_name"],"uploads/" . $_FILES["layout1"] ["name"]); $file="uploads/".$_FILES["layout1"]["name"]; $this->model_user->add_user_case1($file); } else { $phase_name=$_POST['phase_name']; //$layout=$_POST['layout']; if($phase_name=='0') { $config['upload_path'] = './uploads/'; $config['allowed_types'] = '*'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); $this->upload->do_upload('layout'); $data = $this->upload->data(); move_uploaded_file($_FILES["layout"]["tmp_name"],"uploads/" . $_FILES["layout" ]["name"]); $file="uploads/".$_FILES["layout"]["name"]; /*$sql=$this->db->query("INSERT INTO phase (layout) VALUES ('$file')");*/ $this->model_user->add_user_case2($projectname,$file); } else { $plan_name=$_POST['plan_name']; if($plan_name=='0' ) { $this->model_user->add_user_case3($phase_name); } else{ $this->model_user->add_user_case4($plan_name); } } } echo '<script>alert("data registered successfully");</script>'; redirect ('controller_search','refresh'); } 
5
  • can you show controller_user/checker code? Commented Oct 7, 2014 at 10:23
  • it's not my all form code.I just copy paste one part of it to explain Commented Oct 7, 2014 at 10:36
  • @LLL see my edit above Commented Oct 7, 2014 at 10:39
  • please check if any other form tag is there before this form and check for proper closing of form tag Commented Oct 7, 2014 at 10:43
  • I think you can use error_log to write post log at beginning checker method , and why don't you use ci input $this->input->post()? Commented Oct 7, 2014 at 10:44

1 Answer 1

1

Problem is here

<div id="prj" style="display: none;"> 

remove display none and try it with, it displayed none inside it

<input type="text" name="prname" required/> 

the text field it required so it validating the form and it doesn't allow the form to submit

<form enctype="multipart/form-data" method="POST" action=<?php echo base_url()."index.php/controller_user/checker"; ?> > <table width="100%" border="0" > <tr> <td> <table> <tr> <td> <div id="prj" >Enter Project:-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="prname" required/> </div> <div id="project">Enter Project:-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <select class="prj_name" name="prj_name" id="prj_name" onchange="process(this.value)" tabindex="11" required> <option selected="selected">Select Project</option> <?php $sql = "SELECT * FROM project ORDER BY prj_id DESC"; $query = $this->db->query($sql); if ($query->num_rows() > 0){ foreach ($query->result() as $row){ $projectName= $row->prj_name; $projectID=$row->prj_id; echo '<option value="'.$projectID.'">'.$projectName.'</option>'; }//end of for loop echo '<option value="'.'0'.'">'.'New Project'.'</option>'; } ?> </select> </div> </td> </tr> <tr> <td> <input type="submit" name="submit" value="Submit"/> </td> </tr> </table> </form> 
Sign up to request clarification or add additional context in comments.

2 Comments

what exactly I should do??
Yes that is the problem :) hope you fixed

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.