EZE Posted January 17, 2007 Share Posted January 17, 2007 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 More sharing options...
Eugene Posted January 17, 2007 Share Posted January 17, 2007 try [code=php:0]if(isset($txt)) {....}[/code] Link to comment https://forums.phpfreaks.com/topic/34510-bbcode-editor/#findComment-162540 Share on other sites More sharing options...
fert Posted January 17, 2007 Share Posted January 17, 2007 you have magic quotes enabled Link to comment https://forums.phpfreaks.com/topic/34510-bbcode-editor/#findComment-162542 Share on other sites More sharing options...
EZE Posted January 17, 2007 Author Share Posted January 17, 2007 What are magic quotes? And were is the if statement supposed to go? (I am completely clueless, sorry.) Link to comment https://forums.phpfreaks.com/topic/34510-bbcode-editor/#findComment-162544 Share on other sites More sharing options...
fert Posted January 17, 2007 Share Posted January 17, 2007 http://us2.php.net/magic_quotes Link to comment https://forums.phpfreaks.com/topic/34510-bbcode-editor/#findComment-162547 Share on other sites More sharing options...
EZE Posted January 17, 2007 Author Share Posted January 17, 2007 I'm not fully understanding, what code would i put in? Link to comment https://forums.phpfreaks.com/topic/34510-bbcode-editor/#findComment-162556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.