输入法WYSIWYG编辑器没有在mysql数据库中存储值?

时间:2016-04-15 12:08:46

标签: javascript php mysql ckeditor

我正在使用WYSIWYG编辑器在我的门户网站中输入作业说明但是它没有将值存储到数据库中 这是我的代码

       <form class="form-horizontal" role="form" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
        <div class="form-group">
           <label class="control-label col-sm-2" for="jtitle">Job Title</label>
              <div class="col-sm-10">
           <input type="text" class="form-control" id="jtitle" name="jtitle" placeholder="Enter job title">
  </div>
</div>   
     <div class="form-group">
  <label class="control-label col-sm-2" for="duration">Job Duration</label>
  <div class="col-sm-10">
    <input type="text" class="form-control" id="duration" name="duration" placeholder="Enter duration">
  </div>
</div>
   <div class="form-group">
  <label class="control-label col-sm-2" for="budget">Budget</label>
  <div class="col-sm-10">
    <input type="text" class="form-control" id="Budget" name="budget" placeholder="Enter Budget">
  </div>
</div>
       <div class="form-group">
  <label class="control-label col-sm-2" for="keyskills">Key Skills</label>
  <div class="col-sm-10">
    <input type="text" class="form-control" id="keyskills" name="keyskills"placeholder="Enter Skills">
  </div>
</div>
       <div class="form-group">
  <label class="control-label col-sm-2" for="jobdescription">Job Description</label>
  <div class="col-sm-10">
    <input type="textarea" rows="1000" class="form-control" id="jobdescription" name="jobdescription" placeholder="Enter Job Description">
   <script type="text/javascript">
          CKEDITOR.replace( 'jobdescription' );
   </script>
  </div>
      </div>
      <div class="form-group">
  <label class="control-label col-sm-2" for="edate">Expiry Date</label>
  <div class="col-sm-10">
       <input type="date" class="form-control" id="edate" name="edate" placeholder="Click to enter expiry date">
  </div>
</div>
      <div class="form-group">
  <label class="control-label col-sm-2" for="cdexmin">Candidate Experience Minimum</label>
          <div class="col-sm-10">
    <input type="number" class="form-control" id="cdexmin" name="cdexmin" placeholder="Enter Minimum Experience">
  </div>
</div>
       <div class="form-group">
  <label class="control-label col-sm-2" for="cdexmax">Candidate Experience Maximum</label>
            <div class="col-sm-10">
    <input type="number" class="form-control" id="cdexmax" name="cdexmax" placeholder="Enter Maximum Experience">
  </div>
     </div>
        <div class="form-group">        
          <div class="col-sm-offset-2 col-sm-10">
          <button type="submit"  name="submit" class="btn btn-default">Post Job</button>
         </div>
         </div>
        </form>

<?php
    if(isset($_POST['submit'])) {
      try {
           // Establish server connection and select database
           $username=$_SESSION['username'];

           $stmt = $db->prepare("SELECT * FROM employer  
                      INNER JOIN  company ON employer.cid= company.cid  
                      WHERE employer.username='$username' ");
           $stmt->execute();
           $row = $stmt->fetch(PDO::FETCH_ASSOC);
           $cid=$row['cid'];
           $eid=$row['eid'];
           $jtitle=$_POST['jtitle'];
           $duration=$_POST['duration'];
           $budget=$_POST['budget'];
           $keyskills=$_POST['keyskills'];
           $jobdescription=$_POST['jobdescription'];
           $edate=$_POST['edate'];
           $cdexmin=$_POST['cdexmin'];
           $cdexmax=$_POST['cdexmax'];
           $stmt = $db->prepare("INSERT INTO 
                     job(cid,eid,jtitle,duration,budget,
                         keyskills,jdesc,edate,
                         cdexmin,cdexmax)
                  values('$cid','$eid','$jtitle','$duration','$budget',
                         '$keyskills','$jobdescription','$edate',
                         '$cdexmin','$cdexmax') ");

           $stmt->execute();
           $result="Successfully Job Posted to view your Job It should be activated by Admin";
           header("Location:/emprdash?success=1");
     } catch(PDOException $e){
          echo "Error occurs:". $e->getMessage();
     }   
   }
?>

所有值都在输入但作业描述只是没有更新我下载的ckeditor并且还将文件上传到服务器并且我在我的页面中附加了javascript ckeditor.js但是没有更新表格中的值是否有任何错误或我能为此做些什么

1 个答案:

答案 0 :(得分:3)

Gowri,输入标签中没有textarea类型,请更改以下代码

<input type="textarea" rows="1000" class="form-control" id="jobdescription" name="jobdescription" placeholder="Enter Job Description">

<textarea rows="1000" class="form-control" id="jobdescription" name="jobdescription" placeholder="Enter Job Description"></textarea>