admin管理员组文章数量:1024934
How do I make my textinput accept apostrophe or double quotes?
Everytime a user type's in this one: John's Birthday, I store this one in the database using mysql_real_escape_string().
What I wanted to do in here is to retrieve it in my text input. I tried this one
<input type='text' name='title' value='<?php echo $values->title; ?>' />
The problem here is it removes the single quote and the letters that es after the quote.
I tried to changed the value= ''
from value=""
but what if a user types a word that has example this one:
"You and Me". The problem is still in there.
I was thinking to use str_replace in doing this one and replace the ' into `, but again I was thinking that maybe there's an easy way to do it.
Any help would be greatly appreciated.
Thanks!
How do I make my textinput accept apostrophe or double quotes?
Everytime a user type's in this one: John's Birthday, I store this one in the database using mysql_real_escape_string().
What I wanted to do in here is to retrieve it in my text input. I tried this one
<input type='text' name='title' value='<?php echo $values->title; ?>' />
The problem here is it removes the single quote and the letters that es after the quote.
I tried to changed the value= ''
from value=""
but what if a user types a word that has example this one:
"You and Me". The problem is still in there.
I was thinking to use str_replace in doing this one and replace the ' into `, but again I was thinking that maybe there's an easy way to do it.
Any help would be greatly appreciated.
Thanks!
Share Improve this question asked Sep 29, 2011 at 1:16 PinoyStackOverflowerPinoyStackOverflower 5,30218 gold badges66 silver badges134 bronze badges 1- 3 Duplicate of stackoverflow./questions/1771798/… – nnnnnn Commented Sep 29, 2011 at 1:21
3 Answers
Reset to default 4Check out this: http://www.primitivetype./articles/quotes_inputs.php
Basically, call htmlentities
on your output before placing it in the form's value. This will turn characters like '
into the html equivalent '
.
e.g.
<input ... value='<?php echo htmlentities($values->title, ENT_QUOTES); ?>' />
You can replace double quotes with "
. '
for single quotes.
Replace single quote with ‘
How do I make my textinput accept apostrophe or double quotes?
Everytime a user type's in this one: John's Birthday, I store this one in the database using mysql_real_escape_string().
What I wanted to do in here is to retrieve it in my text input. I tried this one
<input type='text' name='title' value='<?php echo $values->title; ?>' />
The problem here is it removes the single quote and the letters that es after the quote.
I tried to changed the value= ''
from value=""
but what if a user types a word that has example this one:
"You and Me". The problem is still in there.
I was thinking to use str_replace in doing this one and replace the ' into `, but again I was thinking that maybe there's an easy way to do it.
Any help would be greatly appreciated.
Thanks!
How do I make my textinput accept apostrophe or double quotes?
Everytime a user type's in this one: John's Birthday, I store this one in the database using mysql_real_escape_string().
What I wanted to do in here is to retrieve it in my text input. I tried this one
<input type='text' name='title' value='<?php echo $values->title; ?>' />
The problem here is it removes the single quote and the letters that es after the quote.
I tried to changed the value= ''
from value=""
but what if a user types a word that has example this one:
"You and Me". The problem is still in there.
I was thinking to use str_replace in doing this one and replace the ' into `, but again I was thinking that maybe there's an easy way to do it.
Any help would be greatly appreciated.
Thanks!
Share Improve this question asked Sep 29, 2011 at 1:16 PinoyStackOverflowerPinoyStackOverflower 5,30218 gold badges66 silver badges134 bronze badges 1- 3 Duplicate of stackoverflow./questions/1771798/… – nnnnnn Commented Sep 29, 2011 at 1:21
3 Answers
Reset to default 4Check out this: http://www.primitivetype./articles/quotes_inputs.php
Basically, call htmlentities
on your output before placing it in the form's value. This will turn characters like '
into the html equivalent '
.
e.g.
<input ... value='<?php echo htmlentities($values->title, ENT_QUOTES); ?>' />
You can replace double quotes with "
. '
for single quotes.
Replace single quote with ‘
本文标签: javascriptPHP How to I make my textinput accept single quote or Double quotesStack Overflow
版权声明:本文标题:javascript - PHP How to I make my textinput accept single quote or Double quotes - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745504710a2153552.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论