Search code examples
phpsmarty

How to assign array value to textarea in smarty php


I have form where i have to edit this information. I can fetch all the fields to edit except description. Why textarea is not accepting dynamic array value? this is my issue.Please help me to fix this. Thanks in advance!!.

  <form id="commentForm" name="commentForm" action="index.php?mdf=addbiography" method="POST"      enctype="multipart/form-data" >
    {if $admindetails[0].name neq ''}
    <input type="hidden" id="action" name="action" value="saveupdate">
    <input type="hidden" id="upid" name="upid" value="{$admindetails[0].id}">
    {else}
    <input type="hidden" id="action" name="action" value="add_biography">
   {/if}
   <article class="module width_full">

      <header><h3 style="color: white;">&nbsp;&nbsp;Add Biography</h3></header>
        <div class="module_content">
   <fieldset>
    <div><label>Name<span class="star">*</span></label>
<input type="text" id="cname" name="name" class="required" value="{$admindetails[0].name}"></div></br></br></br>

  <label>Description:<span class="star">*</span></label>
  <textarea   cols="60" rows="5" type="text" class="required" name="description"     id="description" value="{$admindetails[0].description}"></textarea></br></br></br><br><br><br><br>

   <div><label>Type<span class="star">*</span></label>
                <select name="type" id="type" >
                <option value="personal">Personal</option>
                <option value="professional">Professional</option>
                </select>

   </div></br>

   <div><label>Image<span class="star">*</span></label>
    {if $admindetails[0].image eq ''}
   <input type="file" name="file" id="file" style="margin-left:10px;" accept="image/*" class="required" value="">
  {else}
  <input type="file" name="file" id="file" style="margin-left:10px;" accept="image/*" value="">
  {/if}
  </div></br>
   <img src="upload/{$admindetails[0].image}" width="300" height="300" alt="">

     </fieldset>
        <div class="clear"></div>
      </div>
        <footer>
            <div class="submit_link">



                <input type="submit" value="Save">
                <input type="reset" value="Reset">

            </div>
        </footer>
     </article><!-- end of stats article -->
     </form>

Solution

  • Have you try doing this..

    <textarea   cols="60" rows="5" type="text" class="required" name="description"     id="description" >{$admindetails[0].description}</textarea>