Search code examples
phpjquerytrim

proper Trim function


Ok, I am a total newbie and cannot figure out where to place the trim function on a code that a developer created for a client. The current form places "\" before any apostrophe and I have googled solutions and tried placing functions in the file but everything I do breaks the client's form. Any help is appreciated.

The current structure is:

$dd_description =   $_POST['dd_description'];

and the review page of the form is:

Description:<strong> '. $dd_description .'</strong><br />

I just cannot seem where to place the 'trim'


Solution

  • Just allowing unparsed POST variables to appear on a users webpage is NOT recommended for security reasons.

    Have you tried adding stripslashes() to the code?

    Description:<strong> '. stripslashes($dd_description) .'</strong><br />
    

    I'd recommend securing the input data further, perhaps wrap strip_tags around it also at least.