[Solved] how assign value to a variable using anchor tag [duplicate]

No you can not assign values to PHP variable using onClick (JavaScript Function), but it is possible to capture and set URL param through $_GET method. If you are using Codeigniter, you must load CodeIgniter URL Helper Library first. $this->load->helper(‘url’); try below, <?php if(isset($_GET[‘view_set’]) && $_GET[‘view_set’] == ‘list’) { $view_set = “list”; echo “i am … Read more

[Solved] Highlight The Menu [closed]

When calling view pass variable which will have $data[‘selectedItem’] = ”; $this->load->view(‘blogview’,$data); In blogview <li class=”<?php echo $selectedItem == ‘menuItem1’ ? ‘selected’ : ”; ?>”>menuItem1</li> <li class=”<?php echo $selectedItem == ‘menuItem2’ ? ‘selected’ : ”; ?>”>menuItem2</li> 0 solved Highlight The Menu [closed]

[Solved] send email by using codeigniter library via server

thanks… i done it with same code… just change the port then its working…. here is code function do_email($msg=NULL, $sub=NULL, $to=NULL, $from=NULL){ $this->load->library(’email’); $config = array(); $config[‘protocol’]=’smtp’; $config[‘smtp_host’]=’localhost’; $config[‘smtp_port’]=’587′; $config[‘charset’]=’utf-8′; $config[‘newline’]=”\r\n”; $config[‘wordwrap’] = TRUE; $config[‘mailtype’] = ‘html’; $this->email->initialize($config); $this->email->from($from, $system_name); $this->email->to($to); $this->email->subject($sub); $this->email->message($msg); $email = $this->email->send(); } solved send email by using codeigniter library via … Read more

[Solved] mysql , codeigniter active record class [closed]

try this out….(normal mysql) SELECT t1.*,t2.image FROM table1 t1 LEFT JOIN table2 t2 on t1.house_id=t2.house_id WHERE t1.status= 1 GROUP BY t1.house_id ORDER BY house_id desc active record… $this->db->select(t1.*,t2.image); $this->db->from(‘table1′.’ t1′); $this->db->join(‘table2′.’ t2′,’t1.house_id=t2.house_id’,’left’); $this->db->where(‘t1.status’,1); $this->db->group_by(“t1.house_id”); $this->db->order_by(“house_id”); 6 solved mysql , codeigniter active record class [closed]

[Solved] I have an array of dynamic data, how to display that with ordered list as mega menu

Couple of foreach loops should do the trick: <?php $arr = array( ‘properties’ => array( 0 => array( ‘sub’ => ‘hello’ ), 1 => array( ‘sub’ => ‘world’ ) ), ‘cars’ => array( 0 => array( ‘sub’ => ‘hello1’ ), 1 => array( ‘sub’ => ‘world2’ ) ) ); print_r($arr); echo ‘<ul>’; foreach ($arr as … Read more

[Solved] php get the first part of postcode

This will not cover 100% of all possible UK postcodes, but will do for like 99.999% or so 🙂 /** * @param string $postcode UK Postcode * @return string */ function getUKPostcodeFirstPart($postcode) { // validate input parameters $postcode = strtoupper($postcode); // UK mainland / Channel Islands (simplified version, since we do not require to validate … Read more

[Solved] Hide registration and login buttons when a user logged in? [closed]

<div id=’nav’> <?php if(is_logged_in()) { if(is_admin()) { echo anchor(‘admin’,’Admin Dashboard’); } echo anchor(‘user/logout’,’Logout’); echo anchor(‘users/profile’,’Profile’ . ‘&nbsp;[‘ . $_SESSION[‘user_name’] . ‘]’); } else { echo anchor(‘user/login’,’Login’); echo anchor(‘user/signup’,’Signup’); } echo ‘&nbsp;’ . anchor(base_url(),’Home’); ?> </div> 1 solved Hide registration and login buttons when a user logged in? [closed]

[Solved] Only getting the first character of the array element

From your array the foreach loop should look like this $toilet_arr = array ( 0 => ‘Water Sealed’, 1 => ‘Open Pit’, 2 => ‘None’ ); if (count($toilet_arr)) { foreach($toilet_arr as $row) { $data = array(“hof_id”=>$last_id,”toilet_type”=>$row); $this->db->insert(‘toilet_tbl’,$data); } } This should insert values as they are if the problem still persists check the length in … Read more