Notifications
Clear all

Apostrophes and text disappearing from custom text fields

14 Posts
5 Users
0 Likes
2,538 Views
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

URL to your eFiction: http://www.jamlyfics.com
Version of eFiction: 3.5.3
Have you bridged eFiction, if so with what?: Nope  
Version of PHP: 5.2.15
Version of MySQL: 5.0
Have you searched for your problem: yes
If so, what terms did you try: Just about every combination of profile, edit bio, apostrophe, htmlentities, htmlspecialchars, disappearing text, missing text, custom field, text field, etc.
State the nature of your problem: When a user goes to the Edit Bio page, apostrophes and all text after them are not showing up in the (custom) text fields.  It shows up in the profiles and the text is being stored in the database in its entirety.  Whenever a user returns to their edit bio page, though, apostrophes and everything after it do not reappear in the text field.  If the user wants to save their profile, they have to retype those parts every time.
Do you have a test account for us?  User: test/pass: test

Mods/other things: The archive shares its author table with another installation of efiction ( http://beta.jamlyfics.com).  Challenge module is activated.

I don't know if this will help, but here is the code I'm using for the form output on one of the text fields in question.  The other text fields are exactly the same but use a different label/name/title:

$output .= "<div><label for='favbook'>".$field['field_title'].":</label><INPUT type='text' class='textbox'  
name='af_".$field['field_name']."' maxlength='1000' value='".(!empty($user['af_'.$field['field_id']]) ? $user['af_'.$field['field_id']] : "")."' size='20'></div>";

The custom profile code:

$thisfield = $field['info'];

 
Posted : 01/05/2011 12:11 am
(@usagi-chan)
Posts: 14
Active Member
 

It might be the magic quotes. Is it turned on or off on your host?

 
Posted : 02/05/2011 12:07 am
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

Thank you for responding. πŸ™‚

Magic quotes are turned off.

 
Posted : 02/05/2011 12:31 am
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

I probably should have asked this earlier, but is there any other information I can provide to clarify my issue or help more on my end?

 
Posted : 03/05/2011 4:56 am
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

Man, I feel like such a bother/nag.  Does anybody have at least a vague idea of what I can do to solve this?  I've been trying different things with htmlspecialchars, htmlentities, stripslashes, etc. but maybe that isn't the issue.  Just a nudge in the right direction would be an incredible help.

Probably going to sound like a broken record with this, but thank you guys so much for even just taking a look at the thread.  Your time is really appreciated.

 
Posted : 15/05/2011 9:27 pm
(@lyndsie)
Posts: 1262
Member Moderator
 

Sorry, I don't know much about that kind of thing. I guess the only thing that I would suggest would be to make sure what's being input is actually ' and not the HTML or other equivalent.

 
Posted : 15/05/2011 10:35 pm
(@tammy)
Posts: 2577
Member Moderator
 

Give us an example.  Because when I go to the edit bio page using your test account everything worked fine for me.

 
Posted : 16/05/2011 2:11 pm
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

Here is how the text is entered on the edit bio page.  

From there, I click save.  It shows up in the profile properly.

When you go back to the edit bio page, however, the full text doesn't reappear in the text box.

Could it be the field type used (tinyint)?  Would this be solved if I used a text box (like what's used for the edit bio field) and how would I do that?

 
Posted : 16/05/2011 5:40 pm
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

Hmm.  Would it help if I changed the form code to a text box rather than the small text field it is now?  (And if so, how would I do so?  I've tried using <textarea> but that doesn't work.)  This is still stumping me.

 
Posted : 01/06/2011 6:23 am
(@guest9883)
Posts: 0
New Member Guest
 

Turn magic quotes on - this should solve the issue. If not, you will need to manually escape the string for special characters like single quotes and apostrophes. For now, check if turning magic quotes off fixes it, else we can try other ways.

 
Posted : 02/06/2011 10:26 pm
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

I'm unable to turn magic quotes on on my hosting. πŸ™  How would I go about manually escaping the string?

(And thank you for the help!)

 
Posted : 04/06/2011 5:49 pm
(@guest9883)
Posts: 0
New Member Guest
 

You will need to use mysql_real_escape_string() or addslashes() while inserting the data into the database and then use stripslashes() while showing it

 
Posted : 07/06/2011 3:41 pm
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

Man, I just have the worst luck.  I tried those three things (in various combinations/orders) but the best to come of that was this:

At worst, I just got an error page or the field no longer showed up on editbio at all.

I checked the table and the data is being stored correctly (with all apostrophes and any text that follows),  if that changes anything.

 
Posted : 09/06/2011 1:18 pm
(@ryuukari)
Posts: 9
Active Member
Topic starter
 

Probably going to seem like an impatient/annoying nag, but I haven't been able to find a solution to this yet. πŸ™ 

In concern with the last piece of advice posted by raidenace, is it possible that I'm not putting those things in the right place(s)?

 
Posted : 27/08/2011 1:14 pm
Share: