Jump to content

How to add fckeditor to a dynamically creating form in php???


hmdnawaz

Recommended Posts

function htmlEventFormGenerator($asd){

 

$out = '<form id="mainform" enctype="multipart/form-data" action="index.php" method="post"><div class="eventdiv"><h2 class="contentHeading">Add Event</h2>';

  ?>

  <div class="divInner1">

  <?php

      include('fckeditor.php');

      $oFCKeditor = new FCKeditor('description') ;

      $oFCKeditor->BasePath = $sBasePath ;

      $value2 = $oFCKeditor->Value = 'ahmad';

     

      //$value2 = $oFCKeditor->Value;

      $oFCKeditor->Height = '100px';

      $oFCKeditor->Create();

     

      ?>

     

     

      </div>

    <?php

        $sql="SELECT title FROM events";

        $r = mysql_query($sql);

        $out.="<label>Display on front screen</label><Input type = 'checkbox' name ='displayonfront' value= '1'/><br><br>";

        $out.='<label>Parent</label>';

       

        $out.='<SELECT  name ="eventparent">';

        $out .='<OPTION value="0">'."Null".'</OPTION>';

        while ($row = mysql_fetch_array($r)){

          $out .='<OPTION value="'.$row['title'].'">'.$row['title'].'</OPTION>';

        }

        $out.='</SELECT>';

       

        $zain = $_POST["date"];

        echo $zain;

        foreach ($asd as $key => $value){

              $out.= "<div><label>$value[label]</label><input type='$value[type]' name='$key' value='$value[value]'/></div> <br>";

              if($key=="title"){

              $out.= '<div><label>Event Date</label><input  type="text" id="myDate" name="date" /><a href="javascript:NewCal(\'myDate\',\'yyyymmdd\')"><img src="images/cal.gif" width="22" height="22" border="0" alt="Pick a date"></a></div>';

              }

              if($key=="place"){

                $out.= '<div><label>Event Description</label></br></br></br></br></br></br></br></br></div>';

            }

          }

         

        $out.= "<input type='hidden' value='$value2' name='description'></input></div></form>";

        return $out;

 

}

 

 

The above function creates a dynamic form and in that function i write the code of fckeditor.

The database insertion is on another page.

when i run the code it only save the default value of fckeditor in database which is ahmad and not any other text entered after execution.

 

What is the problem??

Please help me.

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.