Welcome Guest, Not a member yet? Register   Sign In
double url's with form post
#1
Bug 
(This post was last modified: 12-27-2020, 12:30 PM by zayno70.)

Hello All,
i'm new to codeigniter and i ant some help regarding forms and form post.I have read the user guide about form builder but then i coded the form and the process php, and when i tested it i got a double url instead of the process php.
what i mean is i get http://localhost/website1/index.php/http...me/process
instead i want http://localhost/website1/index.php/welcome/process.

the welcome controller file is like this:
Code:
    public function index()
    {
        $this->load->view('welcome_message');
    }

    public function form(){
        $this->load->helper('form');
      $this->load->view('form');
    }

    public function process(){
        $this->load->view('process');
    }

and the form is like this:
PHP Code:
<?php
        
//echo form_open('create_user.php');
        echo form_open('welcome/process');
        echo form_label('Username ''user_id').'&nbsp;&nbsp;';
        echo form_input(['name' => 'user_id ','placeholder' => 'Enter Username'])."<br>";

        echo form_label('Password ''password').'&nbsp;&nbsp;&nbsp;';
        echo form_input(['type' => 'password''name' => 'pass','placeholder' => 'Enter password'])."<br><br>";

        echo form_submit('btnSubmit''Create User');

        echo form_close(); 
and the routes is like this:
Code:
$route['default_controller'] = 'welcome';
$route['form'] = 'welcome/form';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
Reply
#2

When you added your base_url in app/Config.php did you put an ending / slash?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(12-27-2020, 02:05 PM)InsiteFX Wrote: When you added your base_url in app/Config.php did you put an ending / slash?
no i did not
Reply
#4

(12-27-2020, 02:05 PM)InsiteFX Wrote: When you added your base_url in app/Config.php did you put an ending / slash?
i put the slash and it worked thank you very much for your help Big Grin
Reply
#5

Glad it worked for you.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB