我做了一个简单的形式为用户添加电子邮件和城市的通讯形式运作良好,并在数据库中插入数据,但我使用,因为英语和阿拉伯语用户两种形式,现在我需要在两个表格上添加隐藏输入其次我需要重定向为每隐藏输入我能做些什么,请建议和指导我解决这个问题,为了方便我共享完整的代码为文件。
ar_signup.php的意见
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Landing Page</title>
<meta charset="utf-8">
<link href="assests/css/ar/ar.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="columnout" class="left">
<div id="column">
<a id="lanLnk" href="http://english.halalat.com" title="english" target="_blank">english</a>
<?php echo validation_errors(); ?>
<?php echo form_open('user/create_user'); ?>
<div class="OptForm">
<label>
<span style="color:white; font-size: 13pt"><img src="assests/images/ar/email.png" class="opt1">الايميل</img></span>
<input id="email" type="text" name="email">
</label>
<label>
<span style="color:white; font-size: 13pt"><img src="assests/images/ar/city.png" class="opt2">المدينة</img>
</span>
<select name="city" id="city">
<option value="jeddah" selected="selected">جدة</option>
<option value="riyadh">الرياض</option>
<option value="dammam">الدمام</option>
<option value="makkah">مكة المكرمة</option>
<option value="madina">المدينة</option>
</select>
</label>
<label>
<input id="submit-btn" name="Submit" type="submit" class="button" value="Submit">
</label>
</div>
<?php echo form_close(); ?> <!-- end of Form -->
<div class="footer_terms">
<a href="#" target="_blank">تسجيل الدخول</a>
| <a href="#" target="_blank">سياسة الخصوصية</a>
| <a href="#" target="_blank">الشروط والأحكام</a>
</div>
<div class="social">
<a href="http://www.facebook.com/halalat" target="_blank"><img src="assests/images/ar/facebook.png" width="48" height="48"></a>
<a href="http://www.twitter.com/halalatksa" target="_blank"><img src="assests/images/ar/twitter.png" width="48" height="48"></a>
<a href="#" target="_blank"><img src="assests/images/ar/linkedin.png" width="48" height="48"></a>
</div>
<!-- end of Footer -->
</div><!-- end of Cloumn Left -->
</div>
<div id="background-img" style=" margin-top:0; margin-left: auto; margin-right: auto; top:0px; left:0px; padding:0px; right top no-repeat; position:relative; z-index:1;">
<img src="assests/images/ar/bg_ar2.jpg" width="1181" height="650" alt=""></div>
</div><!-- end of Wrapper -->
</body>
</html>
ar_thanks.php鉴于
<html>
<head>
<meta name="keywords" content="Souq.com,Deal,Day,Best Prices">
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Halalat Landing Page</title>
<link href="assests/css/ar/thankyouar.css" rel="stylesheet" type="text/css" media="screen">
<link href="assests/css/ar/reset.css" rel="stylesheet" type="text/css" media="screen">
</head>
<body>
<div id="wrapper">
<div id="columnout" class="left">
<div id="column">
<a id="lanLnk" href="http://english.halalat.com" title="english" target="_blank">english</a>
<div class="footer_terms">
<a href="#" target="_blank">????? ??????</a>
| <a href="#" target="_blank">????? ????????</a>
| <a href="#" target="_blank">?????? ????????</a>
</div>
<div class="social">
<a href="http://www.facebook.com/halalat" target="_blank"><img src="assests/images/ar/facebook.png" width="48" height="48"></a>
<a href="http://www.twitter.com/halalatksa" target="_blank"><img src="assests/images/ar/twitter.png" width="48" height="48"></a>
<a href="#" target="_blank"><img src="assests/images/ar/linkedin.png" width="48" height="48"></a>
</div>
<!-- end of Footer -->
</div><!-- end of Cloumn Left -->
</div>
<div id="background-img" style=" margin-top:0; margin-left: auto; margin-right: auto; top:0px; left:0px; padding:0px; right top no-repeat; position:relative; z-index:1;">
<img src="./images/bg_ar2.jpg" width="1181" height="650" alt=""></div>
</div><!-- end of Wrapper -->
</body>
</html>
user.php的控制器中
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function create_user()
{
// field name, error message, validation rules
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('city', 'City', 'trim|required');
if($this->form_validation->run() == FALSE)
{
$this->load->view('ar_signup');
}
else
{
$this->load->model('Users_model');
//if($query = $this->Users_model->create_member())
{
$this->load->view('ar_thanks');
}
}
}
}
users_model.php模型
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Users_model extends CI_Model
{
function create_member()
{
$new_member_insert_data = array(
'email' => $this->input->post('email'),
'city' => $this->input->post('city'),
);
$insert = $this->db->insert('users', $new_member_insert_data);
return $insert;
}//create_member
}