title: Editor for editable data
body: <p>I am trying to allow my users to be able to go back and edit the date they've entered. My page returns a list of the events that a user has created. I have a form that has a title, start date and a end date. I want to add a button beside my delete button that the user can press so that they are brought back to the form which shows the data they've previously saved and allow them to edit and reserve this form. Any help would be greatly appreciate. My current code is below: </p>
  
  <pre><code> &lt;?php
  
  if(!$user-&gt;isLoggedIn()) {
      Redirect::to('/index.php');
  } 
  //require_once '../core/init.php';
  $user = new User();
  
  $user-&gt;bring_li('date', array(
          'id'    =&gt;  array(
              'operator'  =&gt; '!=',
              'value'     =&gt; '')
                  ), 'd_order_o', 'cmp_r');
  
      $output ="";
  //'.date('l, F jS, Y', strtotime($row-&gt;start)).'
      foreach ($user-&gt;variable_pro() as $row) {
           if($user-&gt;data()-&gt;access == 2) { 
          $output .= '&lt;tr class="account_row" id="c_'.$row-&gt;id.'"&gt;
  &lt;td &gt;
  
  &lt;/td&gt;
  &lt;td &gt;
  
  &lt;span class="balance-btc "&gt;
  &lt;span class="full"&gt;'.date('M d, y', strtotime($row-&gt;start)).' - '.date('M d, y', strtotime($row-&gt;end)).'&lt;/span&gt;
  &lt;/span&gt;&lt;/td&gt;
  &lt;td &gt;
  &lt;span &gt;
  &lt;span class="full"&gt;'.$row-&gt;event.'&lt;/span&gt;
  &lt;/span&gt;
  
  
  &lt;/td&gt;
  
  
  &lt;td class="settings"&gt;
  &lt;li&gt;&lt;a href="#" onclick="Delete(\''.$row-&gt;id.'\')" &gt;Delete&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" onclick="switchTab(\''.$row-&gt;id.'\')"&gt;Edit&lt;/a&gt;&lt;/li&gt;
  
  &lt;/td&gt;
  &lt;/tr&gt;';
           } else {
               $output .= '&lt;tr class="account_row" id="c_'.$row-&gt;id.'"&gt;
  &lt;td class="clickable type"&gt;
  
  &lt;/td&gt;
  &lt;td class="clickable name"&gt;
  
  &lt;span class="balance-btc "&gt;
  &lt;span class="full"&gt;'.date('M d, y', strtotime($row-&gt;start)).' - '.date('M d, y', strtotime($row-&gt;end)).'&lt;/span&gt;
  &lt;/span&gt;&lt;/td&gt;
  &lt;td class="clickable balance"&gt;
  &lt;span class="balance-btc "&gt;
  &lt;span class="full"&gt;'.$row-&gt;event.'&lt;/span&gt;
  &lt;/span&gt;
  
  
  &lt;/td&gt;
  
  &lt;td class="settings"&gt;&lt;/td&gt;
  &lt;/tr&gt;';
           }
      };
  
  
  if(isset($_POST['date'])) {
              try {
                  $user-&gt;create('date', array(
                      'event'     =&gt;trim(Input::get('title')),
                      'start'     =&gt;date('Y-m-d',strtotime(Input::get('start_date'))),
                      'end'   =&gt;date('Y-m-d',strtotime(Input::get('end_date'))),
                      'add_by'    =&gt;$username,
                  ));
  
  
                      $user-&gt;bring_li('users', array(
                          'id'    =&gt;  array(
                              'operator'  =&gt; '!=',
                              'value'     =&gt; ''),
                          'access'    =&gt;  array(
                                  'operator'  =&gt; '=',
                                  'value'     =&gt; '2')
                                  ), 'results');
  
          if($user-&gt;varcount()&gt;0) {
              foreach ($user-&gt;variable_pro() as $row) {
  
      $subject = "Reslife Notification - New Important Date Added";
      $message = "Hello ".$row-&gt;name.",\n\nA new important date has been added by admin ".$display." titled ".Input::get('title')." for dates starting on ".date('l, F jS, Y', strtotime(trim(Input::get('s_month')).'/'.trim(Input::get('s_day')).'/'.trim(Input::get('s_year'))))." and ending on ".date('l, F jS, Y', strtotime(trim(Input::get('e_month')).'/'.trim(Input::get('e_day')).'/'.trim(Input::get('e_year'))))."
  
      Thank you,
      Reslife Connect Notification";
      $email = "no-reply@reslifeconnect.org";
      $from = "".$email."";
      $headers = "From:" . $from;
          mail($row-&gt;email, $subject, $message, $headers);
  
                  }
          }
          } catch(Exception $e) {
                  die($e-&gt;getMessage());
          }
  
      }
  
  
  $ad6 = '&lt;li class="tabItem tabAdd" onclick="switchTab(\'.tabAdd\', \'#add\', \'add\')"&gt;&lt;a class="tabActive"&gt;Add Dates&lt;/a&gt;&lt;/li&gt;';
  
  $ad7 = '&lt;div id="add" class="add-date"&gt;
  &lt;form method="post"&gt;
  &lt;div class="control-group"&gt;
  &lt;label class="control-label"&gt;Title&lt;/label&gt;
  &lt;div class="controls"&gt;
  
  
  &lt;input name="title" placeholder="Title" class="street-address" type="text"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="control-group"&gt;
  &lt;label class="control-label"&gt;Start Date&lt;/label&gt;
  &lt;div class="controls"&gt;
  
  &lt;input name="start_date" placeholder="format: Jan 01, 1970" class="dates" type="text" id="start_date"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="control-group "&gt;
  &lt;label class="control-label" for="identity_verification_dob_day"&gt;End Date&lt;/label&gt;
  &lt;div class="controls"&gt;
  
  &lt;input name="end_date" placeholder="format: Jan 01, 1970" class="dates" type="text" id="end_date"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="control-group"&gt;
  &lt;div class="controls"&gt;
  &lt;input type="submit" name="date" value="Save" class="btn btn-primary"&gt;
  &lt;/div&gt;
  &lt;/div&gt;&lt;/form&gt;
  &lt;/div&gt;';
  </code></pre>
  
  <p>and my switch tab function is the following:</p>
  
  <pre><code>function switchTab(tab, tabPage, tabLink, autoSwt) {
      window.location.hash = tab;
      var pageList= ['.tabBrowse', '#browse', '.tabPast', '#past', '.tabCreate', '#create', '.tabMyevents', '#myevents', '.tabView', '#view', '.tabEval', '#eval'];
      var count = 0;
      var stepCount = 1;
      $(tab+" &gt; .tabActive").addClass("showd");
      $(tabPage).addClass("show");
      while(count &lt; 12) {
          if(pageList[count] != tab) {
              $(pageList[count] + "&gt; .tabActive").removeClass("showd");
              $(pageList[stepCount]).removeClass("show");
          }
          count = count+2;
          stepCount = stepCount+2;
      }
  
  }
  </code></pre>
  
  <p>how do I allow the add date page to be present when the user clicks the edit button. I want whatever is already stored in the fields to be present when the edit button is clicked and updated if the user changes anything.</p>