APIs & Integrations

Diederiikk
Member

Submit data to a form via API - Radio button value not working

Hello,

We have a custom form which sends data from our website to HubSpot using the API.
The form contains text inputs like first name, last name etc, dropdown selects and radio buttons.

The text input values and the dropdown select values are coming through correctly and are visible in HubSpot. But the value of the radio buttons is not working properly: These properties does not show any value in HubSpot and are empty.

Our code is setup as follows.
Part of our HTML:

<input type="radio" id="radio61" value="Strongly Disagree" name="radios11">
<label for="radio61">Strongly Disagree</label>
						
<input type="radio" id="radio62" value="Disagree" name="radios11">
<label for="radio62">Disagree</label>
	    
<input type="radio" id="radio63" value="Somewhat Disagree" name="radios11">
<label for="radio63">Somewhat Disagree</label>
						
<input type="radio" id="radio64" value="Somewhat Agree" name="radios11">
<label for="radio64">Somewhat Agree</label>
						
<input type="radio" id="radio65" value="Agree" name="radios11">
<label for="radio65">Agree</label>
	    
<input type="radio" id="radio66" value="Strongly Agree" name="radios11">
<label for="radio66">Strongly Agree</label>

Part of PHP (code used from https://developers.hubspot.com/docs/methods/forms/submit_form😞

$statement1=$_POST['radios11'];  
$str_post = "wizard_question_availability_1=" . urlencode($statement1)

We first did setup the form in HubSpot. Portal ID and form GUID are correct.
“wizard_question_availability_1” is the internal name of the radio button property in HubSpot.
Values of the input fields equals the internal values in HubSpot.

What could be the issue?

0 Upvotes
1 Reply 1
Diederiikk
Member

Submit data to a form via API - Radio button value not working

This can be closed. After writing this post I noticed that I forgot a ‘=’-sign in my actual code.
So instead of:

$str_post = "wizard_question_availability_1=" . urlencode($statement1)

I used:

$str_post = "wizard_question_availability_1" . urlencode($statement1)