php - Getting raw HTML Textarea within other rextarea (laravel 5.3)

503

I am getting raw html from my controller and getting it into textarea. there is different type of fields as text select or also can be textarea which will be print in textbox as raw html. its working fine for all fields except textarea.

when there is a field include with textarea type then below buttons string code not comes in text box and code of textarea type shows but without ending tag as

here is my code.

 foreach($fields as $field){
  $type = $field->type;
switch($type) {
  case 'textarea':
  $str .=  '<div >
          <label >'.$custom_field->name.'
          </label>
          <div >
            <div >
              <i ></i>
              <textarea name="'.$field->id.'" rows="8"></textarea>
            </div>
          </div>
        </div>';
      break;
   }
}

Now every thing works fine except when textarea type included. problem is if there is textarea type then below buttons not appear and also not ending tag of textarea

this end of html out put is as without buttons sting and without endtag

`<div >
            <label >Description
            </label>
            <div >
              <div >
                <i ></i>
                <textarea name="17" rows="8">`

please help where its wrong

421

Answer

Solution:

You just replace< with&lt; and> with&gt;

Everything else is OK.

Just edit your case to:

case 'textarea':
$str .=  '<div >
        <label >'.$custom_field->name.'
        </label>
        <div >
          <div >
            <i ></i>
            <textarea name="'.$field->id.'" rows="8">&lt;/textarea&gt;
          </div>
        </div>
      </div>';
    break;

People are also looking for solutions to the problem: php - Receiving notification sound only when I disable notification from setting

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.