I want to send post request using html button. I know it is easily done by jQuery ajax, but i do not want to use jquery and ajax. How can i do it?
This my function
public function editProduct() {
if($_SERVER['REQUEST_METHOD'] === 'POST') {
echo 'You are authorized';
} else {
echo 'You are not authorized to access this page.';
}
}
This is my HTML button
<button type="submit" onclick="location.href = '<?=base_url().'company/admin/add_product/editProduct?>';">Send Post Request</button>