| | |
problem printing quota in input box
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I have a string in my database as
in' out"
now i need to show this in input textbox
i did
<input value='in' out"'>
output only: in
also
<input value="in' out"">
output only: in' out
the real output should be
in' out"
Actually i need to do like this
encode ' => '
and " => "
I m using php serverscript
anyone please help me to encode these quotas
in' out"
now i need to show this in input textbox
i did
<input value='in' out"'>
output only: in
also
<input value="in' out"">
output only: in' out
the real output should be
in' out"
Actually i need to do like this
encode ' => '
and " => "
I m using php serverscript
anyone please help me to encode these quotas
Hunters Never Hurt
to encode it in php...
If you have to hard code your HTML input tag with that value, then you'll need to write like this:
if a user is entering that into a form and posting it to your php script, then simply do this:
then you can store that value in database. You may need to strip the slashes off when you pull it from the database (depends on MySQL/PHP config)... to do that:
more on addslashes and stripslashes here
php Syntax (Toggle Plain Text)
<?php //encode input going in... $encode = urlencode("in'out\""); //decode output coming out... $decode = urldecode($encode); ?>
If you have to hard code your HTML input tag with that value, then you'll need to write like this:
html Syntax (Toggle Plain Text)
<input value="'in' out"">
if a user is entering that into a form and posting it to your php script, then simply do this:
php Syntax (Toggle Plain Text)
//escape quotes from posted variable $input = addslashes($_POST['value']);
then you can store that value in database. You may need to strip the slashes off when you pull it from the database (depends on MySQL/PHP config)... to do that:
php Syntax (Toggle Plain Text)
//strip off slashes that were previously added $output = stripslashes($input);
more on addslashes and stripslashes here
The End
addslashes, stripslashes doesnot fix into my problem.
coz i need to handle the both at once for the value of input tag (which have already an quota itself)
- also saving with addslashes will hamper my Fulltext search.
i wold be cool if .. i could get the quota encoding functions.
as: " for '
or something like that
coz i need to handle the both at once for the value of input tag (which have already an quota itself)
- also saving with addslashes will hamper my Fulltext search.
i wold be cool if .. i could get the quota encoding functions.
as: " for '
or something like that
Hunters Never Hurt
Use htmlentities or htmlspecialchars .
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Other Threads in the PHP Forum
- Previous Thread: seach a key word in a table
- Next Thread: Coding like myYahoo - Ajax
Views: 1118 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






