Lost content after submit form

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 40
Joined: Fri Aug 10, 2012 4:37 pm

Tue Sep 11, 2012 7:34 am

It is a big guess, as there is no actual code posted that can cause your problem. But this is my guess:

You need to sanitize your data before putting it in your database:

Code: Select all

   $txtName = mysql_real_escape_string($_REQUEST['txtName']);
 //or (not so save)
   $txtEmail = htmlspecialchars($_REQUEST['txtEmail'], ENT_QUOTES);
 // DONT do this
   $txtContent = addslashes($_REQUEST['txtContent']);   
        // Insert data to database
Better is to use prepare statements, you can do that with mysqli or PDO

Post Reply