1

i have trouble with adding value in database. When i add value in input type with out apostrophe then it's working. Example:

<input type="text" id="sample" name="sample" value="it is good">

But when i put the value with apostrophe it's not working. For example:

<input type="text" id="sample" name="sample" value="it's good">
sanji
  • 121
  • 1
  • 14
  • possible duplicate of [How can I prevent SQL-injection in PHP?](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) – Sougata Bose Jul 24 '15 at 05:14

2 Answers2

0

at php use $var = mysql_real_scape_string($_POST); you need to escape it.

Sougata Bose
  • 31,517
  • 8
  • 49
  • 87
Marcos Brinner
  • 207
  • 2
  • 11
0
$sample = htmlspecialchars($sample,ENT_QUOTES);

this is working. The value is store with "&#39" for "'".

Thanks guys for your help.

sanji
  • 121
  • 1
  • 14