Jump to content

Apostrophe in TEXTAREA or Input text statement works but not now


KobusDippenaar

Recommended Posts

Good day to you all,

 

I have code a webpage accepting input and it allows text such as kobus' or Lynn's house but in a new website it does not. It causes the SQL Server to bomb out with an error.

 

The PHP program was copied and changed to the new website.

 

In both the Data Bases the field definitions are text.

 

As part of a gallery upload program the text has to accept text such as Lynn's new house etc.

 

Appreciate your feedback,

 

Ok, I have added the program below.

 

Blessings.

 

00imgupload.php

Link to comment
Share on other sites

strip_tags is doing you no good here

$mydesc = strip_tags($_POST['mydesc']);

 

You want to escape the data before inserting into mysql with mysqli_real_escape_string()

 

As for character encoding and quotes back and forth to and from database back into html is a lot to go over, instead will link you to functions, you should know what they do before using them.

trim() that incoming data of any whitespace

html_entity_decode()

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

 

If your script works in one and not the other must be differences in php versions, php settings or server configuration

 

Ensure magic_quotes is disabled

Link to comment
Share on other sites

@Guru,

Thanks for the comment, will have a look at it.

 

What I do not understand, is that it is the same computer ie my laptop, nothing has changed and so my version of wampserver.

I am running both website using wampserver and Firefox as browser. (localhost)

 

Thank you once again for your assistance.

 

Blessings

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.