2013-03-12 3 views
0

я иметь такую ​​форму:CodeIgniter представляет неизвестную форму

<html> 
<head> 
<title>التسجيل</title> 
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'> 
</head> 
<body dir="rtl"> 

<?php echo validation_errors(); ?> 

<?php echo form_open('form'); ?> 

<h5>الإسم الكامل:</h5> 
<input type="text" name="fullname" value="" size="50" /> 

<h5>الجوال:</h5> 
<input type="text" name="mobile" value="" size="50" /> 

<h5>هاتف المنزل:</h5> 
<input type="text" name="home" value="" size="50" /> 

<h5>اسم المستخدم:</h5> 
<input type="text" name="username" value="" size="50" /> 

<h5>كلمة السر:</h5> 
<input type="text" name="password" value="" size="50" /> 

<h5>اعادة كلمة السر:</h5> 
<input type="text" name="cpassword" value="" size="50" /> 

<h5>الايميل:</h5> 
<input type="text" name="email" value="" size="50" /> 
<br><br> 
<div><input type="submit" value="التسجيل" /></div> 

</form> 

</body> 
</html> 

Пожалуйста, не обращайте внимания на арабский контроллер writings.The следующим образом:

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

class Membership extends CI_Controller { 

    public function __construct() 
    { 
     parent::__construct(); 
     $this->load->helper(array('form', 'url')); 
     $this->load->library('form_validation');   
    } 

    public function index() 
    { 
     //Loads the login page which has a registration option 
     $this->load->view('login'); 
    } 

    public function register() 
    { 
     $post = $this->input->post(); 
     if($post) 
     { 
      //handle posted data 
      $fullname = $this->input->post('fullname'); 
      $email = $this->input->post('email'); 
      $mobile = $this->input->post('mobile'); 
      $home = $this->input->post('home'); 
      $username = $this->input->post('username'); 
      $password = $this->input->post('password'); 
      $confirmPassword = $this->input->post('cpassword'); 
      $memberType = 'silver'; 

      if ($this->form_validation->run() == FALSE) 
      { 
       $this->load->view('register'); 
      } 
      else 
      { 
       $this->load->view('welcome_message'); 
      } 


     }else{ 
      $this->load->view('register'); 
     } 
    } 

} 

Теперь, когда я нажимаю кнопку представить в форме , он показывает 404 и ссылку в адресной строке: http://domain.com/index.php/form

Почему это происходит? Он должен проверить, отправлен ли, а затем загрузить x. если не загружать y.

Является новичком в кодеиндигере, поэтому извиняюсь.

ответ

1

Как вы скопировали код из CI руководства пользователя:

form_open('form'); // here is a form action which is form class index function 

просто изменить его на:

form_open('membership/register'); 

, что означает:

form_open('location/to/sumbit/to'); 

это все!

+0

правда, я сделал это, но я действительно пытаюсь научиться. С уважением. –

+0

@sys_debug отметьте ответ, если это вам помогло! – sandip

1

Изменить

<?php echo form_open('form'); ?> 

Для

<?php echo form_open('membership/register'); ?> // class/function 
Смежные вопросы