Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Doing a file write, character behavior
Old 08-19-2004, 02:54 PM Doing a file write, character behavior
Average Talker

Posts: 15
Trades: 0
I have a small snippet of code which writes user input to a file.

For some reason, the fputs writes semicolons with an escape character slash, i.e.

user input: it's a nice day, isn't it?

writes as

it\'s a nice day, isn\'t it?


Do I need somehow to tell the fputs that semicolons are OK ? Or perhaps is something happening when the form field data gets parsed and php is adding in that backslash?

Thanks!
new_PHP_er is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-19-2004, 02:58 PM
Unknown.

Posts: 1,693
Trades: 0
I think using the stripslashes function should solve it...
PHP Code:
<?php
$str 
"Is your name O\'reilly?";

// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>
http://uk.php.net/manual/en/function.stripslashes.php

-James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 08-20-2004, 07:38 AM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
but only strip slashes as you are putting it into the file. If you need to use this data for anything else first, leave stripslashes out until you need it.... this may sound strange, but as a newbie I stripped slashes before calling a mysql query..... I still wake up screaming at night....

OK, I don't, but be careful!
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Reply     « Reply to Doing a file write, character behavior
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18543 seconds with 12 queries