I cannot figure out what's going on. I am testing whether a form is submitted or not by this code;
if ($this->request->getMethod() === 'post')
{
}
I have a form per below and am using Codeigniter4;
<!-- show the form -->
<?php
$form = array(
'class' => 'form-control border-0',
);
?>
<?= form_open('Admin/post/post_update', $form); ?>
<?= $this->include('Admin/Post/_post_form.php') ?>
<!-- show buttons -->
<div class="form-group">
<button class="btn btn-primary">Save</button>
</div>
</form>
<!-- end form here -->
For some reason, when I select the submit button and I echo out
echo $this->request->getMethod();
it says 'get'
. I was expecting to read 'post'
.
I read the documentation but cannot see anywhere where I can state make the submit a post instead of get.
When I view the html, it looks correct though as follows;
<form action="https://development.example.com/Admin/post/post_create" class="form-control border-0" method="post" accept-charset="utf-8">