Forum

Notifications
Clear all

Apostrophes and text disappearing from custom text fields

ryuukari
(@ryuukari)
Active Member

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'];

Quote
Topic starter Posted : 01/05/2011 6:11 am
usagi-chan
(@usagi-chan)
Active Member

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

ReplyQuote
Posted : 02/05/2011 6:07 am
ryuukari
(@ryuukari)
Active Member

Thank you for responding. 🙂

Magic quotes are turned off.

ReplyQuote
Topic starter Posted : 02/05/2011 6:31 am
ryuukari
(@ryuukari)
Active Member

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?

ReplyQuote
Topic starter Posted : 03/05/2011 10:56 am
ryuukari
(@ryuukari)
Active Member

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.

ReplyQuote
Topic starter Posted : 16/05/2011 3:27 am
Lyndsie
(@lyndsie)
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.

ReplyQuote
Posted : 16/05/2011 4:35 am
Tammy
(@tammy)
Member Moderator

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

ReplyQuote
Posted : 16/05/2011 8:11 pm
ryuukari
(@ryuukari)
Active Member

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?

ReplyQuote
Topic starter Posted : 16/05/2011 11:40 pm
ryuukari
(@ryuukari)
Active Member

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.

ReplyQuote
Topic starter Posted : 01/06/2011 12:23 pm
Anonymous
 Anonymous
(@Anonymous)
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.

ReplyQuote
Posted : 03/06/2011 4:26 am
ryuukari
(@ryuukari)
Active Member

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!)

ReplyQuote
Topic starter Posted : 04/06/2011 11:49 pm
Anonymous
 Anonymous
(@Anonymous)
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

ReplyQuote
Posted : 07/06/2011 9:41 pm
ryuukari
(@ryuukari)
Active Member

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.

ReplyQuote
Topic starter Posted : 09/06/2011 7:18 pm
ryuukari
(@ryuukari)
Active Member

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)?

ReplyQuote
Topic starter Posted : 27/08/2011 7:14 pm
Share: