0

I am trying to handle a string, of possible input

'something <p>hi</p> <br />'

The input string could contain any, or no HTML tags. I want to handle this string without formatting it.

Essentially I am splitting it at the moment, with a delimiter of &, and I need the output array produced to still contain the input

etc....

$ajaxinput = "function=submit&content=this is some page stuff <p>hi</p>";

        echo 'Input : ' . $ajaxinput . '<br /><br /><br />';

        $output = explode("&", $ajaxinput);
        echo 'Split : ' . $output[0] . '<br /><br />';
        echo 'Split : ' . $output[1];

Output is:

Input : function=submit&content=this is some page stuff
hi




Split : function=submit

Split : content=this is some page stuff
hi

I want:

Input : function=submit&content=this is some page stuff <p>hi</p>




Split : function=submit

Split : content=this is some page stuff <p>hi</p>
2
  • 2
    What are you trying to achieve? What is the question? Commented Nov 28, 2012 at 16:45
  • 1
    htmlspecialchars Commented Nov 28, 2012 at 16:48

2 Answers 2

1

Since you don't remove the HTML tags, they must be there. But since they are HTML tags, you can't see them in the browser unless you use the "View source" menu item.

Sign up to request clarification or add additional context in comments.

Comments

0

Have a look into htmlentities if you want to display those tags (that's my assumption after reading your question):

echo htmlentities($str, ENT_QUOTES, "UTF-8");

htmlentities will convert all applicable characters to HTML entities.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.