Welcome Guest, Not a member yet? Register   Sign In
url brocken / become /2F
#1

I upgraded from CI4.1 or 2 (not sure) to CI4.3
I install a fresh installation and copy views, models controllers etc...

I noticed that lot of change break the code specialy the url. Before I had site_url('controller/method') but the url became like
?%2Fen%2Fgestion%2Flogin%2Flogincheck= / --> %2F I notice I have a ? added and = at the end. 
My solution was to replace site_url by base_url and my / stay /
Now I still have the problem with form_open
Example   echo form_open("/login/logincheck");
--> %2Flogin%2Flogincheck=
How to keep url correctly as I want not as codeigniter wants.
Where do I know all code I need to change like site_url is not valid but replaced by base_url

Maybe I just have to find the correct parameter and all will works as before in previous version.
CodeIgniter 4.1.9
Reply
#2

I cannot reproduce:
PHP Code:
<?php

namespace App\Controllers;

class 
Home extends BaseController
{
    public function index()
    {
        helper('form');
        return form_open("/login/logincheck");
    }

I see <form action="http://localhost:8080/index.php/login/logincheck" method="post" accept-charset="utf-8">
Reply
#3

The version is from this morning 
I installed it with composer
Maybe my configuration has something wrong
CodeIgniter 4.1.9
Reply
#4

(This post was last modified: 02-04-2023, 12:33 PM by cb21.)

My source code looks like
<form action="http://localhost/../index.php?%2Fgestion%2Flogin%2Flogincheck=" method="post" accept-charset="utf-8">

I found a workaround

// echo form_open('gestion/login/logincheck');
$url = base_url('index.php/gestion/login/logincheck');
echo form_open($url);

base_url give me good url
form_open --> wrong url
site_url -->wrong url. I have to change all site_url I had in base_url

Waiting for advice...
CodeIgniter 4.1.9
Reply
#5

Did you change Config files?

The base_url() and site_url() uses the same code in most of the part.
I don't know why site_url() outputs URL encoded values.
Reply
#6

@kenjis do you think I have a wrong version and I should reinstall CI 4.3.1 properly ? I started to change the code but if you say that should not be like this now I doubt that something is wrong in my installation
CodeIgniter 4.1.9
Reply
#7

(02-04-2023, 02:58 AM)cb21 Wrote: I upgraded from CI4.1 or 2 (not sure) to CI4.3
I install a fresh installation and copy views, models controllers etc...

You installed v4.3.1 and copied your views, models controllers etc.
Did you change the Config files?
If you changed the Config, it might cause your issue.

But as I wrote, site_url() and base_url() use almost same code.
So I think it is not likely to be.

What if you install clean v4.3.1 and run?
PHP Code:
echo form_open('gestion/login/logincheck'); 
Reply
#8

(This post was last modified: 02-11-2023, 08:10 AM by cb21.)

What if you install clean v4.3.1 and run?
PHP Code:
echo form_open('gestion/login/logincheck');

--> 
Reinstallation a clean new CI4.3.1 and it worksI don't know what was the cause of this problem but now I can upgrade all my application properly. Thank you for your support.

This subject can be close as resolved 
CodeIgniter 4.1.9
Reply
#9

Some times you may get a bad CodeIgniter download, has happened to me several times in the pass.
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