SirM
SirM

Reputation: 497

Why am I getting slashes when inputing data into mysql?

If I input into mysql

htmlspecialchars("test'ed", ENT_QUOTES, 'UTF-8')

its stored as test'ed.

If I use

htmlspecialchars( $_POST["txtfirstname"], ENT_QUOTES, 'UTF-8')

its stored as test/'d

Whats the deal with the slash when using posted data?

Upvotes: 1

Views: 151

Answers (1)

Nikki9696
Nikki9696

Reputation: 6348

Turn off magic quotes, or use stripslashes. the slash is being inserted for you.

http://php.net/manual/en/function.stripslashes.php

Upvotes: 5

Related Questions