Textarea与htmlentities帮助 [英] Textarea with htmlentities help

查看:81
本文介绍了Textarea与htmlentities帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我不确定在textarea中使用下面的php



  <   textarea     class   = 表格控制    name   =  note_text     =  7   占位符  =  ... >  
< ; php echo htmlentities($ this-> note-> note_text); ?>
< / textarea >





有另外一种方法吗?



我使用htmlentities的原因是为了防止用户输入等等打破HTML



只是因为你知道这是一个用于在数据库中编辑已保存笔记的表格



我尝试过:



我试过这个,但在文本区域的中心奇怪地显示



 <   textarea     class   =  form-control   名称  =  note_text     =   7   占位符 < span class =code-keyword> =  ... >  
<? php echo htmlentities($ this-> note-> note_text); ?>
< / textarea >

解决方案

this-> note-> ; note_text); ?>
< / textarea >





有另外一种方法吗?



我使用htmlentities的原因是为了防止用户输入等等打破HTML



只是因为你知道这是一个用于在数据库中编辑已保存笔记的表格



我尝试过:



我试过这个,但在文本区域的中心奇怪地显示



 <   textarea     class   =  form-control   名称  =  note_text     =   7   占位符 < span class =code-keyword> =  ... >  
<? php echo htmlentities(


this - >笔记记录> note_text); ?>
< / textarea >


因为您的问题是由我所说的(我认为)发生的如果是空白文本区域,则应在将其作为空白提交时检查从该控件发送的值。



如果它是NULL而不是空字符串,则可能导致一些错误。 NULL值不是空字符串 [见此] [ ^ ]。



或许类似于:

 <?php  
if(!isnull(

Hi i'm not sure if using the below php in textarea

<textarea class="form-control" name="note_text" rows="7" placeholder="...">
 <?php echo htmlentities($this->note->note_text); ?>
</textarea>



is there another way to do so?

reason why I use htmlentities is because to prevent user input with " etc. break the HTML

Just so you are aware this is a form for editing a saved note in database

What I have tried:

I have tried this but displays weirdly in center of text area

<textarea class="form-control" name="note_text" rows="7" placeholder="...">
 <?php echo htmlentities($this->note->note_text); ?>
</textarea>

解决方案

this->note->note_text); ?> </textarea>



is there another way to do so?

reason why I use htmlentities is because to prevent user input with " etc. break the HTML

Just so you are aware this is a form for editing a saved note in database

What I have tried:

I have tried this but displays weirdly in center of text area

<textarea class="form-control" name="note_text" rows="7" placeholder="...">
 <?php echo htmlentities(


this->note->note_text); ?> </textarea>


Since your problem happens by what (I think) you describe as a blank text area, you should check what value is sent from that control when you submit it as blank.

If it's a NULL and not an empty string, you are probably causing some errors. A NULL value is not an empty string [see this] [^].

Perhaps something like:

<?php
  if(!isnull(


这篇关于Textarea与htmlentities帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆