I have following textarea
field in question form
where user can post their questions:
<tr>
<th><label><?php echo $this->lang->line('question'); ?>: </label></th>
<td><textarea value="" id="ques_desc" name="ques_desc"
class="validate[required] text-input" > </textarea> </td>
</tr>
The problem is when user copies and paste question from world or excel,
then symbol '
becomes ’
and get stored in the database in the same format.
Example:
Check men's and women's rest rooms
becomes
Check men’s and women’s rest rooms
And when user searches for Check men's
in the search field then
Check men’s
does not appear in the search result.
I tried str_replace function with ’
and '
, it does not worked.
example:
$ques_desc = str_replace("’","'",$ques_desc);
does not replace ’
to '
.
What might be the way to replace each ’
with '
?
EDIT:
When I do this on view page:
<?php
$ques_desc1 = "Check men’s and women’s rest rooms ";
$ques_desc = str_replace("’","'",$ques_desc1);
echo $ques_desc;
?>
It displays:
Check men's and women's rest rooms
It worked!
When I do this on controller:
$ques_desc1 = $this->input->post('ques_desc');
$ques_desc = str_replace(" ",".",$ques_desc1);
It displays:
Take O’pening Stock Count
to Take.O’pening.Stock.Count
it also worked!
But when I do this:
$ques_desc1 = $this->input->post('ques_desc');
$ques_desc = str_replace("’","'",$ques_desc1);
It does not work. Nothing changes.