i made a simple form for users to add email & city for newsletter form is working fine and insert data in db, but i use two form because of english and arabic users now i need to add hidden input on both form secondly i need redirect as per the hidden input what can i do please suggest and guide me to fix this problem, for convenience i share complete codes as files.
ar_signup.php in views
<!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 in view
<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 in controller
<?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 in model
<?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
}