Skip to main content
Participating Frequently
February 3, 2020
Answered

Contact Form Issues

  • February 3, 2020
  • 1 reply
  • 1302 views

Hi, I seem to be having some issues with my Contact Form. When hitting the Submit button, the message I get back is:

"InvalidArgumentInvalid argument.

POST object expects Content-Type multipart/form-data"

I'm not sure how to pin-point this error on this snippet of coding, would anyone here be able to help me out? I'll post the code below.

 

<script type="text/javascript">
function() {
var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a =l.getAttribute('data-cfemail');
if(a){s='';r=parseInt(a.substr(0,2),16);
for(j=2;a.length- j ;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}};
</script>

 

<?php
$name = $_POST['name0'];
$phone = $_POST['phone0'];
$email = $_POST['email0'];
$remarks = $_POST['remarks0'];
$formcontent=" From: $name \n Phone: $phone \n Email: $email \n Remarks: $remarks";
$recipient = "(placeholder text, this is usually filled out, ignore this)";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

<form method="POST" action="contact.php" onSubmit="" name="Contact Us" webbot-action="--WEBBOT-SELF--">
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0" />
<br><strong><p style="font:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; font-size:24px">Contact Us</p></strong>
<form action="_vti_bin/shtml.dll/contactus.htm" method="post" name="Contact Us" id="Contact Us" onsubmit="" webbot-action="--WEBBOT-SELF--">

<strong>Name:</strong><br >
<input name="name0" size="28" type="text" />

<br><strong>Email:</strong><br>
<input name="email0" size="28" type="text" />

<br><strong>Phone:</strong><br >
<input name="phone0" size="28" type="text" />

<br><strong>Message:</strong><br>
<strong>max. 200 characters</strong><br>
<textarea rows="5" name="remarks0" cols="30"></textarea><br>
<input type="submit" value="Submit" name="Contactus0" onclick="gtag_report_conversion"/>
<input type="reset" value="Reset" name="B3" />

<!-- Event snippet for New Website Conversion conversion page
In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};
gtag('event', 'conversion', {
'send_to': 'AW-704540033/A-1ICKOF9cABEIHb-c8C',
'event_callback': callback
});
return false;
}
</script>

This topic has been closed for replies.
Correct answer osgood_

Fortunately I dont know anything about Wix and what they allow or how it works. (It would not be good for my mental health to concerm myself over such matters). They maybe have their own form processing requirements. Why not ask in the Wix forum?

 

Failing that it might be possible to house the php form processing script on a different server which supports php mail and point the form action at that, keeping the form processing separate from Wix.

 

I'm sure Wix has its own requirements as to what can and cant be done reagarding form processing.

 

 

1 reply

Legend
February 3, 2020

Your form code is all mangled up, it has a form sitting within a form. The below is all you need.

 

 

<form method="POST" action="contact.php" name="Contact Us">
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0" />
<br><strong><p style="font:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; font-size:24px">Contact Us</p></strong>
<strong>Name:</strong><br >
<input name="name0" size="28" type="text" />
<br><strong>Email:</strong><br>
<input name="email0" size="28" type="text" />
<br><strong>Phone:</strong><br >
<input name="phone0" size="28" type="text" />
<br><strong>Message:</strong><br>
<strong>max. 200 characters</strong><br>
<textarea rows="5" name="remarks0" cols="30"></textarea><br>
<input type="submit" value="Submit" name="Contactus0">
<input type="reset" value="Reset" name="B3" />
</form>

 

 

Then the php code below goes in your 'contact.php' file which the form points to: action="contact.php" Obviously replace recipient-email-address.com with the correct email address where the form information is being sent to.

 

<?php
$name = $_POST['name0'];
$phone = $_POST['phone0'];
$email = $_POST['email0'];
$remarks = $_POST['remarks0'];
$formcontent=" From: $name \n Phone: $phone \n Email: $email \n Remarks: $remarks";
$recipient = "recipient-email-address.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

 

 

This is entry level form processing. You have no validation or security checks.

Hyde1216Author
Participating Frequently
February 3, 2020

The proper email addresses are already in, I just put that there as a placeholder. What if the current site I'm working on is a Wix site, where I can only make use of specific coding snippets? Is there any way to attach a separate PHP file to that? Basically what I'm trying to do is take a page I worked with in Dreamweaver and move the contact form over to a separate Wix site, while also including my PHP info, which is why it looks the way it does. Is that possible?

Also thank you for the help so far!

osgood_Correct answer
Legend
February 3, 2020

Fortunately I dont know anything about Wix and what they allow or how it works. (It would not be good for my mental health to concerm myself over such matters). They maybe have their own form processing requirements. Why not ask in the Wix forum?

 

Failing that it might be possible to house the php form processing script on a different server which supports php mail and point the form action at that, keeping the form processing separate from Wix.

 

I'm sure Wix has its own requirements as to what can and cant be done reagarding form processing.