I have the following code
<input type="text" id="chapter" name="chapter" value="'.$chapter_title.'"/>
I want to add stripslashes to the ‘.$chapter_title.’
Would I do something like this.
<input type="text" id="chapter" name="chapter" value="stripslashes'.$chapter_title.'"/>
How would I do this – not too sure where to put brackets etc.
Your question is much clearer when you post the whole line. The HTML is part of a string:
It doesn’t really matter that it’s HTML for this question, so let’s make the example shorter:
That’s better. Without HTML’s double-quotes, it’s much clearer what’s going on. The string
$some_stringis the string'abc ', concatenated to the PHP variable$chapter_title, concatenated to the string' !!!'.In fact, any PHP expression will do, not just an expression. In this case you want to concatenate the value of
stripslashes($chapter_title)rather than just$chapter_titleitself, so:Putting the HTML back in:
There is plenty of great recommended reading on PHP. I suggest picking up a book with good reviews and going through it. Twice.