Solved

PHP - Speach Marks in Form Problem

Posted on 2009-05-20
2
297 Views
Last Modified: 2012-05-07
I have a form and somebody entered 8" by 15" into it and it stopped my function working.

How can I clean up the posted text before I send it to my function for processing?
0
Comment
Question by:lwfuk
2 Comments
 
LVL 16

Accepted Solution

by:
Chris Harte earned 125 total points
ID: 24430402
Use the addslashes function.
If you are writing the content to a database use the mysqli_real_escape_string() instead to prevent injection attacks.
<?php

$str = "Is your name O'reilly?";
 

// Outputs: Is your name O\'reilly?

echo addslashes($str);

?>

Open in new window

0
 

Author Closing Comment

by:lwfuk
ID: 31583444
Many thanks.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now