Welcome Guest, Not a member yet? Register   Sign In
$this->input->post() problem
#1

[eluser]whaitie[/eluser]
I hate to be asking for help, but this error is amazing .. I manage to insert data from a form, and followed many tutorials eh, eh and implemented many methods, but I can not get my data reaches my Controller, I attached the code.

section of autoload.php:
Code:
$autoload['helper'] = array('url','text','form');

my form:

Code:
<?php $atributos = array('name' => 'form','id' => 'reg_usuario');
        echo form_open(base_url().'registrarce/enviardatos', $atributos);
        ?>
        <?php
         //variables que contendra todos los atributos e informacion de los campos
        $nombre = array('name' => 'Nombre','placeholder' => 'Tu nombre' , 'type' => 'text', 'id' => 'name', 'value' => 'Nombre');
        $apellido = array('name' => 'apellido', 'placeholder' => 'Tu apellido' , 'type' => 'text', 'id' => 'apellido');
        $email = array('name' => 'email', 'placeholder' => 'Tu E-mail' , 'type' => 'text', 'id' => 'email');
        $email2 = array('name' => 'email2', 'placeholder' => 'Reescribe tu E-mail' , 'type' => 'text', 'id' => 'email2');
        $password = array ('name' => 'password' ,'placeholder' => 'Tu contraseña');
        $password2 = array ('name' => 'password2' ,'placeholder' => 'Repitela nuevamente');
        $calendario = array('name' => 'date', 'placeholder' => '01/01/1996', 'type' => 'text', 'id' => 'datepicker');
        ?>
        <div><label>Nombre:</label>&lt;?php echo form_input($nombre) ?&gt;</div>
        <div><label>Apellido:</label>&lt;?php echo form_input($apellido) ?&gt;</div>
        <div><label>E-mail:</label>&lt;?php echo form_input($email) ?&gt;</div>
        <div><label>Reescribe tu E-mail:</label>&lt;?php echo form_input($email2) ?&gt;</div>
        <div><label>Contraseña:</label>&lt;?php echo form_password($password); ?&gt;</div>
        <div><label>Repetir contraseña:</label>&lt;?php echo form_password($password); ?&gt;</div>
        <div><label>Fecha de nacimiento:</label>&lt;?php echo form_input($calendario) ?&gt;</div>
        <div><label>Genero:</label><select name="genere">
                    <option name="male" value="male">Hombre</option>
                    <option name="female" value="female">Mujer</option>
                </select></div>
        <div><label>País:</label>
            <select name="pais">
                <option value="Argentina">Argentina</option>
                <option value="Bolivia">Bolivia</option>
                <option value="Brazil">Brazil</option>
                <option value="Chile">Chile</option>
                <option value="Colombia">Colombia</option>
                <option value="Ecuador">Ecuador</option>
                <option value="España">España</option>
                <option value="Mexico">Mexico</option>
                <option value="Panama">Panama</option>
                <option value="Paraguay">Paraguay</option>
                <option value="Peru">Peru</option>
                <option value="Puerto_Rico">Puerto Rico</option>
                <option value="Paraguay">Paraguay</option>
                <option value="Uruguay">Uruguay</option>
                <option value="Venezuela">Venezuela</option>
            </select></div>
        
        <div>&lt;?php echo form_submit('submit', 'Crear Cuenta'); ?&gt;</div>
        &lt;?php echo form_close(); ?&gt;

my controller:

Code:
&lt;?php

class Registrarce extends CI_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->model('registro_model');
        $this->load->helper('form');
    }
    
    function index(){
        $this->load->view('Template/head');
        $this->load->view('registro_view');
        $this->load->view("slider_menu_view");
        $this->load->view('Template/footer');
    }
    
    function enviardatos(){
        //if($this->input->post('submit')){
            $data = array(
                'nombre' => $this->input->post('Nombre'),
                'apellido' => $this->input->post('apellido'),
                'password' => $this->input->post('password'),
                'email' => $this->input->post('email'),
                'date' => $this->input->post('date'),
                'genere' => $this->input->post('genere'),
                'pais' => $this->input->post('pais')

            );
            
        //}
        //$this->registro_model->crearUsuario($data);
        
       //$data['nombre'] = 'lokasooo';
       //$data['apellido'] = 'megano';
       //print_r($data);
            
            if($this->input->post('submit') == false){
                echo "No se han resivido datos";
            }
            else if($this->input->post('submit') == true){
                echo "Se han resivido datos";
            }
    }
    
}


my .htaccess:

Code:
Options FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on
    
    RewriteBase /codeigniter

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    RewriteCond $1 !^(assets)
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /codeigniter/index.php
</IfModule>


the result its:

No se han resivido datos

url: http://localhost/codeigniter/registrarce/enviardatos

what is the error? what am I missing?

i want to recieve "Se han recibido datos"
#2

[eluser]CroNiX[/eluser]
You will probably have better luck posting your relevant code here, or on another service like pastebin. In my experience, people will rarely download foreign code to look at it.
#3

[eluser]InsiteFX[/eluser]
Code:
Options FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on
    
    RewriteBase /codeigniter

    RewriteCond $1 !^(assets)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /codeigniter/index.php
</IfModule>
#4

[eluser]CroNiX[/eluser]
rewritebase should also have a trailing /
#5

[eluser]whaitie[/eluser]
**post edited** please read the topic principal edited
#6

[eluser]InsiteFX[/eluser]
Try using site_url() instead of base_url().
#7

[eluser]whaitie[/eluser]
[quote author="InsiteFX" date="1393421302"]Try using site_url() instead of base_url().
[/quote]

thx for your help! Big Grin , i now have the solution, i re-install mi server.

the old server are appserver 2.5.10 , and i install XAMP server, and works really nice ^^

thx guys for all Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB