I am making simple form of posting details in php but got stuck while posting data from form to API but it is showing 405 method not allowed error. Please check my code below and let me know what is the issue in it. Might be I am doing some silly mistake, sorry if that is the case.

```
<form method="POST" action="#" name="checkout">

First Name <input type="text" name="firstName"/><br/>
Last name <input type="text" name="lastName"/><br/>
Email <input type="text" name="phone"/><br/>
Phone <input type="text" name="gender"/><br/>

<input type="submit" name="submit" value="submit"/>

</form>

</body>

</html>

<?php

if(isset($_POST['submit']))
{
    $name = $_POST['firstName'];
    $lastname = $_POST['lastName'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];

    $url11 = "https://api.rezdy.com/v1/categories/124095/products?apiKey=bb42962c78b34e02b879cc5463cb4648";
    $data['customer'] = array(
    'firstName'=>$name,
    'lastName'=>$lastname,
    'email'=>$phone,
    'phone'=>$gender
    );
    echo "<pre>";
    $json = json_encode($data);

    echo $json;
    echo "<br/>";
    function senddatat($url,$post)
    {
        $ch = curl_init();
        curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"POST");
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
        curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
        curl_setopt($ch, CURLOPT_POST,true); 
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','charset=UTF-8 '));
        $result = curl_exec($ch);
/*echo "<pre>";
var_dump( curl_getinfo($ch) ) . '<br/>';
echo curl_errno($ch) . '<br/>';
echo curl_error($ch) . '<br/>';
        curl_close($ch);*/
    return $result;
    }

    echo " ".senddatat($url11,$json);

}
?>

```