0

I am trying to integrate HubSpot into a custom form and my PHP knowledge is limited. So any help would be very much appreciated.

When submitting my form i am getting a log of 204. When I go to my form submissions I can see an entry but no data is being carried across.

Bellow is my form code. HTML:

<input id="first_name" class="hs-input" name="first_name" type="text" placeholder="First Name" autocomplete="given-name" value="" required>
<input id="lastname" class="hs-input" name="last_name" type="text" placeholder="Last Name" autocomplete="family-name" value="" required>
<input id="phonenumber" class="hs-input" name="phone_number" type="number" placeholder="Phone Number" value="" required>
<input value="Submit" typeI"submit">

And i am using the PHP script from this link: https://developers.hubspot.com/docs/methods/forms/submit_form

Thanks

Joe
  • 5
  • 2

1 Answers1

0

A 204 status code is actually a success status code;

The 204 (No Content) status code indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body.

HTTP Protocol definition

So basically it tells you; "Hey, I'm all good. Data received and processed". You don't need additional information do you? Only when it fails you would want to know why it fails.

When you copied the script form the Hubspot API docs, did you notice this line?

//Need to populate these variable with values from the form.

The variables right below that line ($firstname, $lastname, etc) don't actually exist yet. You will have to add something like this before that line;

$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
// etc.
Community
  • 1
  • 1
giorgio
  • 10,111
  • 2
  • 28
  • 41