【发布时间】:2011-04-24 08:27:27
【问题描述】:
<textarea name="email_message" id="email_message" cols="65" rows="15"><?php echo trim($entry['message']);?></textarea>
当我使用上面的 html 代码更新时,它会生成两次包含在消息中的空白行。
例如:
Dear Sir
(here is one now now)
How are you?
当它更新到数据库时,它会像这样保存:
Dear Sir
(here is two lines)
How are you?
每次保存都会增加空白行。
PHP 代码在这里:
function email_template_save()
{
$content = $this->input->post('email_message');
$this->load->model('templates');
$data['msg']=$this->templates->update_email_template($content,$this->session->userdata('username'));
$data['main_content']='message';
$this->load->view('template',$data);
}
function update_email_template($content,$username)
{
$data=array(
'message'=>$this->input->post('email_message'));
$this->db->where('username', $username);
$this->db->update('email_format', $data);
return 'Successfully Updated';
}
【问题讨论】:
-
你能显示你用来更新数据库的php代码吗?
-
我已经更新了 PHP 代码。谢谢
-
也很高兴看到 update_email_template()。
-
我也放了 update_email_template()
标签: php html codeigniter textarea