Forum Moderators: coopster
I am having the problem of my form erroring out when quotes and apostrophes are entered into the form field or text area. It will not insert into a database.
What do you think is the best wat to rectify?
form field:
<textarea name="Comments" rows="8" cols="50"><?php echo stripslashes(ereg_replace('"','"',$webinfo31)); ?></textarea>
Above only removes apostrophe's and not quotes though.
on confirmation page:
{$webinfo31=htmlspecialchars($_POST['Comments']);}
Will this work or is there a better way?
Thanks,
Matt
Geez, I have been doing alot of reading on this and you have to worry so much about hacker codes. I want something that works but will not make my database prone to hacking.
Matt
<p>This, <br>, is a line break in HTML
This,
, is a line break in HTML
<p>This, <br>, is a line break in HTML
<p>This, <br>, is a line break in HTML
If you use htmlspecialchars to put that data into your database then yes, it is going to come out as "plain text" looking in your browser rather than rendered HTML. The safe way to store data in MySQL is using the function that dreamcatcher advised.