|
楼主 |
发表于 2009-6-5 18:42:43
|
显示全部楼层
application\models\payment.php
本帖最后由 acergelff 于 2009-6-8 17:30 编辑
class Payment extends Model{
function Payment(){
parent::Model();
}
function add_pay_log(){
$now = date("Y-m-d H:i:s");
$topuplog= array(
'user_name' => $this->input->xss_clean($this->input->post('user_name')),
'topup_time' =>$now,
'price' =>$this->input->xss_clean($this->input->post('price')),
'status' =>'1'
);
$this->db->insert('pay_topup_log', $topuplog);
}
}
welcome.php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->helper('form');
$data['title'] = "用户中心";
$data['headline'] = "欢迎您的光临!";
$data['include'] = 'home';
$this->load->vars($data);
$this->load->view('template');
}
function Payment(){
$this->output->enable_profiler(TRUE);
$this->load->helper('url');
$this->load->model('payment',' ',TRUE);
$this->ayment->add_pay_log();
redirect('welcome/thankyou','refresh');
}
}
提交的表单如下
echo form_open('welcome/Payment');
echo form_label('用户名','name');
$ndata = array('name' => 'user_name', 'id' => 'id', 'size' => '25');
echo form_input($ndata);
echo form_label('金额','email');
$edata = array('name' => 'price', 'id' => 'email', 'size' => '25');
echo form_input($edata);
echo form_submit('submit','充值');
echo form_close(); |
|