Jump to content

BBcode Editor


EZE

Recommended Posts

Okay, I am fairly new to php, I have only been using it about 1-3 months, and I have a problem with a form input. I am trying to remove any html tags that have been submitted and have them show/echo as plain text, and I used htmlentities(), and this works, except when I enter a quote in the form and submit it, it adds a \ before the quote. Heres my script: [code]<?
$self= $_SERVER['PHP_SELF'];
$txt = $_POST['txt'];
if( $txt == NULL ){
$form ="<form method=\"post\" name=\"txt_check\" action=\"$self\">";
$form.="Enter Some Text: ";
$form.="<input type=\"text\" name=\"txt\" value=\"Some Text Here\" onfocus=\"if(this.value=='Some Text Here') this.value = '';\" onblur=\"if(this.value == '') this.value = 'Some Text Here';\"/> ";
$form.="<input type=\"submit\" value=\"Submit\" onSubmit=\"this.value='Submitting...'; this.disabled=true;\"/>";
echo $form;
}
else{
$msg = htmlentities($txt);
echo "Why Did You Write $msg?";
}
?>[/code] What did i do wrong?
Link to comment
https://forums.phpfreaks.com/topic/34510-bbcode-editor/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.