I have a problem when the login button is pressed the url becomes
http://localhost/library% 20/-login/login_aksi
How do I get rid of %20?
Controller
function login_aksi() {
if ($sebagai == "admin") {
$cek = $this->m_data->cek_login('admin', $where)->num_rows();
$data = $this->m_data->cek_login('admin', $where)->row();
if ($cek > 0) {
$data_session = array(
'id' => $data->id,
'username' => $data->username,
'status' => 'admin_login'
);
$this->session->set_userdata($data_session);
redirect(base_url() . 'admin');
} else {
redirect(base_url() . 'login?alert=gagal');
}
View
<body class="bg-dark">
<div class="container">
<br /><br /><br /><br />
<h3 class="font-weight-normal text-center text-white">SISTEM
INFORMASI</h3>
<h2 class="font-weight-normal text-center text-white mb5"><b>PERPUSTAKAAN</b></h2>
<div class="col-md-4 offset-md-4">
<div class="card">
<div class="card-body">
<?php
if (isset($_GET['alert'])) {
if ($_GET['alert'] == "gagal") {
echo "<div class='alert alert-danger font-weight-bold textcenter'>LOGIN GAGAL!</div>";
} else if ($_GET['alert'] == "belum_login") {
echo "<div class='alert alert-danger font-weight-bold textcenter'>SILAHKAN LOGIN TERLEBIH DULU!</div>";
} else if ($_GET['alert'] == "logout") {
echo "<div class='alert alert-success font-weight-bold textcenter'>ANDA TELAH LOGOUT!</div>";
}
}
?>
<h4 class="font-weight-bold text-center mb-3 mt-3">LOGIN</h4>
<!-- validasi error -->
<?php echo validation_errors(); ?>
**<form method="post" action="<?= base_url() . 'login/login_aksi'; ?>">**