204 Error - Hubspot Form Error - php

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

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.

Related

PHP script doesn't say there is an error but it won't send to MySQL

I found a lot of these on the side but I don't understand them. Can someone just post the good code and point the wrong things out.
Code didn't want to be posted here is a foto of it
html form
php action
If it helps iam using byethost so I could be something byethost related
Your post indexing is wrong. You can not use value of id attrbute with POST. You have to use value of name attribute so change your code to
$_POST['firstname'] AND $_POST['lastname']
A few things: 1. form should be specified method.
<div>
<form action="login_action.php" method="post" >
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" >
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" >
</div>
otherwise, the form will be using get method, and there is no data send to $_POST. refer to http://www.w3schools.com/tags/att_form_method.asp
As #User7 mentioned. The data index in $_POST is based on the input name, not id
$sql ='INSERT INTO login_info(fname, lname) VALUES ("'.$_POST['firstname'].'","'.$_POST['lasttname'].'")';
if(!mysql_query($sql, $con)){
die('error:'.mysql_error());
}

What method call does this HTML code use

I am trying to create a PHP or Perl script which will POST (or GET) contents of the Google Login page with the username and password and return Google notifications, but I am confused at what method call Google is using. I though the method call was required but I guess I was wrong
<input id="Email" name="Email" placeholder="Enter your email" type="email" value="" spellcheck="false" autofocus="">
(Shouldn't it also have a method for GET or POST)
The page I'm trying to make the calls on is located on https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1#identifier

Wufoo - POSTing to Form API - form can't accept new entries

I am using the Wufoo form api to POST to a form on my account, But despite following the documentation I run into this error:
This form can't accept new entries. Please inform the owner of the form so they can contact Wufoo Support
So far the following requirements have been met:
Using correct subdomain and form identifier
Using version 3
Response = JSON
Using Basic Authentication used with API Key and password
Sending the parameters as an array "FieldID" => "Value"
Form set to public
Password protected my form
Yet I still get this error, is there anything else I / the documentation is missing?
I was very frustrated by this issue too.. it seems that that response is given anytime you give the API form ID's it's not expecting (like Field4, Field4-1, Field4-2) instead of simply combining them into one Field (at least for me)
I had a phone number field that wuFoo split into 3 parameters:
<li id="foli4" class="phone notranslate">
<label class="desc" id="title4" for="Field4">
Phone Number
</label>
<span>
<input id="Field4" name="Field4" type="tel" class="field text" value="" size="3" maxlength="3" tabindex="4"/>
<label for="Field4">###</label>
</span>
<span class="symbol">-</span>
<span>
<input id="Field4-1" name="Field4-1" type="tel" class="field text" value="" size="3" maxlength="3" tabindex="5" />
<label for="Field4-1">###</label>
</span>
<span class="symbol">-</span>
<span>
<input id="Field4-2" name="Field4-2" type="tel" class="field text" value="" size="4" maxlength="4" tabindex="6" />
<label for="Field4-2">####</label>
</span>
</li>
In PHP, I decomposed this via http_build_query($_POST) into:
Field4=555&Field4-1=555&Field4-2=5555 and sent it via the boilerplate code they provide over cURL https://wufoo.github.io/docs/?shell#submit-entry.
Sending this returned the response:
{"Success":0,"ErrorText":"This form can't accept new entries. Please inform the owner of the form so they can contact Wufoo Support.","FieldErrors":[]}
When I sent this However:
Field4=5555555555 in my post body, the form submission succeeds!
It appears that even though WuFoo splits parts of its form into several components, it's expecting the response to be concatenated together, otherwise it freaks out.
Hope this helps all of you out there struggling with the WuFoo API!

Joomla! Contact form inside an article, can't get action php file working

I'm trying to create a contact form on my own. I noticed that it can be achieved by placing the form inside an article, instead of a custom html module.
In the client side, it seems to work. I even added a captcha manually (the re-captcha plugin doesn't seem to work for me). The problem is, I set form's action property as "mail.php", and just added this "mail.php" file to the the template root. The "mail.php" supossedly retrieves the data send by post, and finally composes and sends the email, showing a "message send" notification.
Anyway, when I click on submit, the form page is just reloaded. I guess that Joomla! can't find my "mail.php". I guess that this issue is related to the joomla structure and my inability to place the "mail.php". Any help will be wellcome.
This is how my article looks like (wysiwyg editor mode disabled):
<form action="mail.php" method="post" target="_blank">
<p><label for="nombre">Nombre:</label></p>
<p><input maxlength="50" name="nombre" size="30" type="text" /></p>
<p><label for="email">Email:</label></p>
<p><input maxlength="50" name="email" required="required" size="30" type="text" /></p>
<p><label for="asunto">Asunto:</label></p>
<p><input maxlength="150" name="asunto" size="30" type="text" /></p>
<p><label for="mensaje">Mensaje:</label></p>
<p><textarea cols="50" maxlength="700" name="mensaje" required="required" rows="8"></textarea></p>
<div class="g-recaptcha" data-sitekey="6Lefblahblahblahblah"> </div>
<p><input type="submit" /></p>
</form>

php form sanitation before sending to external url

I have a form on my site that gets submitted to a third party site which basically adds the form data as a record in the third party database. This is implemented with the form "action" attribute. I have no control over what the third party does after the form is submitted. See below for the implementation.
I'm doing javascript validation, but I also need to be able to do server-side sanitation and validation of the form data with php before it gets sent to the third party. I may also want to implement a CAPTCHA.
What approach can I take to achieve this? I thought about having the form submit to the script that houses the form, and collecting all of my $_POST variables, do the validation, and then maybe redirect to the third party URL, but not quite sure how the third party would receive all the form data if its not longer the form action. Is it possible to just tack all of my form variables on as a query string the third party URL?
<form id="contactform" name="contactform" onsubmit="return validateForm(this)" method="post" encType="multipart/form-data" action="https://thirdpartysite.com/db/?action=AddRecord&apptoken=xxx">
<input class="contactfield required contact_name_first" type="text" id="firstname" name="firstname" placeholder="FIRST NAME" />
<input class="contactfield required contact_name_last" type="text" id="lastname" name="lastname" placeholder="LAST NAME" />
<input class="contactfield required contact_org" type="text" id="organization" name="organization" placeholder="ORGANIZATION" />
<input class="contactfield required contact_email" type="text" id="email" name="email" placeholder="EMAIL" />
<input class="contactfield required contact_phone" type="text" id="phone" name="phone" placeholder="PHONE" />
<textarea class="contactfield required contact_msg" id="message" name="message" cols="40" rows="10" placeholder="HOW CAN WE HELP YOU?"></textarea>
<input type="hidden" name="rdr" value="http://www.mysite.com/thank-you" /><!-- Note: this gets passed to the third party site as the page to redirect back to after third party site receives the form data" -->
</form>

Categories