problem printing quota in input box

Thread Solved

Join Date: Jun 2007
Posts: 57
Reputation: naju is an unknown quantity at this point 
Solved Threads: 2
naju's Avatar
naju naju is offline Offline
Junior Poster in Training

problem printing quota in input box

 
0
  #1
Mar 8th, 2008
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
Hunters Never Hurt
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: problem printing quota in input box

 
0
  #2
Mar 8th, 2008
to encode it in php...

  1. <?php
  2.  
  3. //encode input going in...
  4. $encode = urlencode("in'out\"");
  5.  
  6. //decode output coming out...
  7. $decode = urldecode($encode);
  8.  
  9. ?>

If you have to hard code your HTML input tag with that value, then you'll need to write like this:
  1. <input value="'in' out&quot;">

if a user is entering that into a form and posting it to your php script, then simply do this:

  1. //escape quotes from posted variable
  2. $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:

  1. //strip off slashes that were previously added
  2. $output = stripslashes($input);

more on addslashes and stripslashes here
The End
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 57
Reputation: naju is an unknown quantity at this point 
Solved Threads: 2
naju's Avatar
naju naju is offline Offline
Junior Poster in Training

Re: problem printing quota in input box

 
0
  #3
Mar 8th, 2008
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: &quot; for '
or something like that
Hunters Never Hurt
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,761
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: problem printing quota in input box

 
0
  #4
Mar 10th, 2008
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 57
Reputation: naju is an unknown quantity at this point 
Solved Threads: 2
naju's Avatar
naju naju is offline Offline
Junior Poster in Training

Re: problem printing quota in input box

 
0
  #5
Mar 10th, 2008
Thanks bro,

htmlspecialchars solve my problem ..

once again thanks a lot
Hunters Never Hurt
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum


Views: 1118 | Replies: 4
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC