Welcome Guest, Not a member yet? Register   Sign In
Escaping the trademark symbol with MySQL
#4

[eluser]TWP Marketing[/eluser]
Ok, here's my code, I've obviously stripped some lines to compress this... I hope it's enough, I'll expand it if needed. The "Entry" field is the text that is misbehaving.
Please note that I am NOT using form validation.
The controller:
Code:
case 'update_section':
     // read the POSTed fields, encode if needed
     $ds = array(
      'ID'           => $this->input->post('dsID'),
      'Heading'      => htmlentities( $this->input->post('Heading'),ENT_QUOTES ),
      'Entry'        => htmlentities( $this->input->post('Entry'),ENT_QUOTES ),
      'SectionOrder' => $this->input->post('SectionOrder')
     );
     $query = $this->Ugmmodel->update_ds_record(&$ds);  // update single record
     $data['dsID'] = $this->input->post('dsID');        // set ID for get
     $this->Ugmmodel->get_ds_record(&$data);            // get the record
     $this->Ugmmodel->build_view_content(&$data);     // build the CONTENT portion of view
     $this->load->view('ugmdocshell',&$data);           // display view
     break;
The model:
Code:
function update_ds_record(&$ds)
{
  $this->db->where('ID', $ds['ID']);
  $query = $this->db->update('prj_docsections',&$ds);
  return $query;
}

function get_ds_record(&$data)
{
  $this->db->where('ID',$data['dsID']);            // ID matches single records
  $query = $this->db->get('prj_docsections');      // get records meeting Where criteria
  $data['dsCount'] = $query->num_rows();           // get number of records found
  if ( $data['dsCount'] > 0)
  {
   $row = $query->row();
    $data['dsdocID']        = $row->docID;
    $data['dsHeading']      = html_entity_decode( $row->Heading );
    $data['dsEntry']        = html_entity_decode( $row->Entry );
    $data['dsSectionOrder'] = $row->SectionOrder;
   $query->free_result();
   return TRUE;
  }
}
The view:
Code:
<?php
$fdsHeading = array(
'name'      => 'Heading',
'id'        => 'Heading',
'value'     => set_value('Heading',$dsHeading),
'maxlength' => 100,
'size'      => 40
);
$fdsEntry = array(
'name'  => 'Entry',
'id'    => 'Entry',
'value' => set_value('Entry',$dsEntry),
'rows'  => '10',
'cols'  => '60'
);
$fdsSectionOrder = array(
'name'      => 'SectionOrder',
'id'        => 'SectionOrder',
'value'     => set_value('SectionOrder',$dsSectionOrder),
'maxlength' => 3,
'size'      => 3
);
echo form_open('ugm/prjedit'.'/'.$prjID.'/'.$docID.'/'.$dsID );
echo form_hidden('action','update_section');
echo form_hidden('prjID',$prjID);                                  // POST prjID
echo form_hidden('docID',$docID);                                  // POST docID
echo form_hidden('dsID',$dsID);                                    // POST dsID
echo form_hidden('oldSectionOrder',$fdsSectionOrder['value']);     // POST original SectionOrder for comparison
echo 'Section Record ID:';
echo $dsID;
echo 'Display Order:';
echo form_input($fdsSectionOrder);
echo 'Heading:';
echo form_input($fdsHeading);
echo 'HTML Content:';
echo form_textarea($fdsEntry);
echo form_submit('dschangesubmit', 'Update this Section');
echo form_close();
?>


Messages In This Thread
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 03:39 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 04:03 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 04:17 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 04:47 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 04:53 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 04:58 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 05:07 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 05:11 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 05:12 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 05:17 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 05:39 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-04-2009, 06:00 PM
Escaping the trademark symbol with MySQL - by El Forum - 03-05-2009, 03:37 AM
Escaping the trademark symbol with MySQL - by El Forum - 03-05-2009, 12:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB