How to escape '/' in codeigniter, php?

tusDeletomo

New Member
Hey guys. I'm having this silly issue with inserting text with forwardslash into cart in codeigniter. When it's plain string it's fine but when inserting, say, "compact / compact" it's not doing it. My guess is that '/' needs to be somehow escaped. I tried hmtlspecialchars(), htmlentities() and even addslashes() - none of the worked. Does anyone know how to do that in php? When I'm inserting something to cart, I'm doing it like this:\[code\]$release_barcode = $this->uri->segment(3); $release = $this->Lists_model->get_release_by_barcode($release_barcode); foreach($release as $row): { $barcode = $row->EAN_UPC; $price = $row->product_price; $currency = $row->product_currency; $artist_name = $row->artist_name; $label_name = $row->label_name; $release_name = $row->title; $cover = $row->cover; $item_name = $artist_name.', '.$release_name.', '.$label_name; $data = http://stackoverflow.com/questions/3786149/array('id' => $barcode, 'qty' => 1, 'price' => $price, 'name' => $artist_name, 'options' => array('pic' => $cover, 'currency' => $currency) ); $this->cart->insert($data); } endforeach; $this->display_cart();\[/code\]Perhaps I'm doing something wrong here. Can you give me a hint please?
 
Back
Top