Welcome Guest, Not a member yet? Register   Sign In
getting the select value
#8

[eluser]_Moat_[/eluser]
i'll try my best to include what ever piece of code required.

controller:
Code:
public function Index()
{
$query = array();
$data['frm1_ctg'] = $this->edit_page_db->getPageInfo("4");
if ($this->input->post('form1'))
{
        $business = $this->input->post('business_f1');
$street = $this->input->post('street');
$city = $this->input->post('city');
$postal = $this->input->post('postal');
$phone = $this->input->post('phone');
$category = $this->input->post('ID');
$query = array('PAGE_NAME'=> $business, 'PAGE_CATEGORY_ID'=> null,'OFFICIAL_PAGE'=> null,'START_DATE'=>null,'STREET_ADDRESS'=>$street,'CITY_TOWN_NAME'=>$city,'CITY_TOWN_ID'=>null, 'POSTCODE'=>$postal, 'ABOUT' => null, 'COMPANY_OVERVIEW' => null, 'DESCRIPTION' => null, 'MISSION' => null, 'AWARDS'=>null, 'PRODUCTS'=>null, 'PHONE' => $phone, 'EMAIL'=>null, 'WEBSITE' => null);
echo "$business . $street . $city . $postal . $phone . $category ";
//  Businnes Or Place Street Adress City/Country Postal Code Phone 0 "HERE"
if ($business != "Business or Places" && $street != "Street Adress" && $city != "City/Country" && $postal != "Postal Code" && $phone != "Phone"  )
{  
     $this->form_validation->set_rules('ID','Category','required');
     $this->form_validation->set_rules('business_f1','Business or Places','required');
     $this->form_validation->set_rules('street','Street Adress','required');
     $this->form_validation->set_rules('city','City or Country','required');
     $this->form_validation->set_rules('postal','Postal Code','required');
     $this->form_validation->set_rules('phone','Phone','required');  
}
} // end of if ($this->input->post('form1'))
if (!$this->form_validation->run())
  {
   $data['message_error'] =  validation_errors();  
   $this->load->view('create_page',$data);
  }
  else
  {
   $this->edit_page_db->saveInfo($query);
   $this->load->view('edit_page_info',$data);
  }
} //end of index

view:

Code:
<select name="ID">
<option>Chose a Category</option>
&lt;?php $i = 0; foreach ($frm1_ctg as $key) { ?&gt;
<option value="&lt;?php echo set_value() == "" ? ($frm1_ctg[$i]['ID']) : set_value("ID") ?&gt;">&lt;?php echo $frm1_ctg[$i]['CATEGORY_NAME'];?&gt;
</option>
&lt;?php $i++;} ?&gt;
</select>
&lt;input id="business_f1" name ='business_f1' value="&lt;?php echo set_value() == "" ? "Businnes Or Place" : set_value("business"); ?&gt;" type="text" class="stretch"&gt;
&lt;/input&gt;
&lt;input id="street" name ='street' value="&lt;?php echo set_value() == "" ? "Street Address" : set_value("street"); ?&gt;" type="text" class="stretch"&gt;
&lt;/input&gt;
&lt;input id="city" name = 'city' value ="&lt;?php echo set_value() == "" ? "City/Country" : set_value('city'); ?&gt;" type="text" class="stretch"&gt;
&lt;/input&gt;
&lt;input id="postal" name = "postal" value="&lt;?php echo set_value() == "" ? "Postal Code" : set_value('postal'); ?&gt;" type="text" class="stretch"&gt;
&lt;/input&gt;
&lt;input id="phone" name = "phone" value="&lt;?php echo set_value() == "" ? "Phone" : set_value('phone'); ?&gt;" type="text" class="stretch"&gt;
&lt;/input&gt;
&lt;input value="true" type="checkbox" id="checkbox_text_f1"&gt;
<div id="checkbox_text">I agree to</div>
<a href="/" class="igotshare_terms">IGotShare Pages Terms</a>
&lt;/input&gt;
&lt;input type="submit" class="submit_btn" value="Get Started" name="form1"&gt;

model:

Code:
class edit_page_db extends CI_Model
{
function __construct()
  {
  $this -> load -> database();
  }
public function saveInfo($query)
{
  $this -> db -> insert('igs_page', $query);
}

public function getPageInfo($parentID)
{
  $sql = "select ID, CATEGORY_NAME from igs_page_category where CATEGORY_PARENT_ID in ($parentID)";
  $query = $this -> db -> query($sql,$parentID);
  if ($query -> num_rows() > 0)
   {
   foreach ($query->result_array() as $row)
   {
                         $ctg_ids[] = $row;
    }
   return $ctg_ids;
  }
}


this is all my old code nothing changed


Messages In This Thread
getting the select value - by El Forum - 07-12-2012, 10:56 AM
getting the select value - by El Forum - 07-12-2012, 01:02 PM
getting the select value - by El Forum - 07-12-2012, 01:03 PM
getting the select value - by El Forum - 07-12-2012, 01:07 PM
getting the select value - by El Forum - 07-12-2012, 01:07 PM
getting the select value - by El Forum - 07-12-2012, 01:26 PM
getting the select value - by El Forum - 07-12-2012, 01:42 PM
getting the select value - by El Forum - 07-12-2012, 02:46 PM
getting the select value - by El Forum - 07-12-2012, 02:59 PM
getting the select value - by El Forum - 07-12-2012, 03:03 PM
getting the select value - by El Forum - 07-15-2012, 04:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB