• I have a site which is using wordpress to imput items into the database but I have written a php page myself which is pulling out info from post_content which all works fine.

    At present I have the code

    —————-

    $biogtext = htmlspecialchars($biogitem[‘post_content’]);

    // Paragraphs and line breaks
    $biogtext = ereg_replace(“\r\n”, “\n”, $biogtext);
    $biogtext = ereg_replace(“\r”, “\n”, $biogtext);
    $biogtext = ereg_replace(“\n\n”, ”, $biogtext);
    $biogtext = ereg_replace(“\n”, ‘
    ‘, $biogtext);

    echo “$biogtext”;

    —————-

    This all works fine but if I want to use tags such as strong’ etc… in wordpress, they are outputted as such.

    If I remove the htmlspecialchars part of the code, then the tags work, but it doesn’t validate. I know what htmlspecialchars does and why this is happening. I just don’t know how to fix it so I can use the tags (‘strong”em’) in wordpress, and it validates too.

    I hope this is clear and someone can shed light on this.

    Many Thanks

  • The topic ‘htmlspecialchars xhtml validation’ is closed to new replies.