Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

HTML Form to Trello card

Recently I have tried to make a "Feedback form" but untill now it has not worked. I did a quick search and I found a post (Out of 2015, so it might be outdated) and there we're some nice things in it, but it does not work unfortunately.

<?php
if ($_POST) {
  $card_name = htmlspecialchars($_POST['title']);
  $card_content = htmlspecialchars($_POST['content']) . "\n";
  $card_content .= htmlspecialchars($_POST['name']) . " (" . htmlspecialchars($_POST['email']) . ")";

  $trello_key          = '(KEY)';
  $trello_api_endpoint = 'https://api.trello.com/1/members/me/?key=(KEY)&token=(TOKEN)';
  $trello_list_id      = 'dEf2tD2e';
  $trello_member_token = 'MYTOKEN'; // Guard this well

  $url = 'https://api.trello.com/1/cards';
  $fields='token='.$trello_member_token;
  $fields.='&key='.$trello_key;
  $fields.='&idList='.$trello_list_id;
  $fields.='&name='.$card_name;
  $fields.='&desc='.$card_content;

  $result = trello_post($url, $fields);
}

function trello_post($url, $fields){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  curl_setopt($ch, CURLOPT_HEADER, 0);    curl_setopt($ch, CURLINFO_HEADER_OUT, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $output = curl_exec($ch);
  curl_close($ch);
  return json_decode($output);
}
?>

<form id="trello" method="post" class="form-horizontal">
    <div class="form-group">
        <div class="col-md-6">
            <input type="text" name="name" placeholder="Name" class="form-control" />
        </div>
        <div class="col-md-6">
            <input type="email" name="email" placeholder="E-Mail" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-12">
            <input type="text" name="title" placeholder="Title" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-12">
            <textarea name="content" cols="40" rows="10" placeholder="Content" class="form-control"></textarea>
        </div>
    </div>
    <div class="form-group">
        <input type="submit" value="Submit">
    </div>
</form>

It is pretty simple, but unfortunately I can't get it to work. Please help & explain.

Already thanks, Chris

Comments