CodeIgniter Forums
double url's with form post - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: double url's with form post (/showthread.php?tid=78273)



double url's with form post - zayno70 - 12-27-2020

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//localhost/website1/index.php/welcome/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;



RE: double url's with form post - InsiteFX - 12-27-2020

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


RE: double url's with form post - zayno70 - 12-27-2020

(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


RE: double url's with form post - zayno70 - 12-27-2020

(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


RE: double url's with form post - InsiteFX - 12-27-2020

Glad it worked for you.