I'm running a php script that is supposed to send an email when the form is submitted. When I submit the form I receive the following error.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>Missing file part</Details></Error>
This is my html code
<html lang="en">
<head>
<script src="email_me.php"></script>
<meta charset="utf-8">
</head>
<section class="contact_us1">
<form action="email_me.php" method="post" role="form" aria-label="contact form" enctype="multipart/form-data">
<div>
<input id="field1" aria-invalid="false" name="Name" value="" placeholder="Name" data-aid="nameField" type="text" required>
<input id="field2" aria-invalid="false" name="Email" value="" placeholder="Email" data-aid="emailField" type="text" required>
<input id="field4" aria-invalid="false" name="Subject" value="" placeholder="Subject" data-aid="subjectField" type="text">
</div>
<textarea name="Message" class="message" placeholder="Message" data-aid="messageField" ></textarea>
<button type="submit" >Send</button>
</form>
</section>
And this is my PHP script
<?php
if($_POST["submit"]) {
$recipient="my@email.com"; //Enter your mail address
$subject=$_POST["Subject"]; //Subject
$sender=$_POST["Name"];
$senderEmail=$_POST["Email"];
$message=$_POST["Message"];
$mailBody="Name: $sender\nEmail Address: $senderEmail\nSubject:$subject\n\nMessage: $message";
mail($recipient, $subject, $mailBody);
sleep(1);
header("Location:http://www.affordtotrip.com/"); // Set here redirect page or destination page
}
?>
I am using google cloud as the server, for which I created a bucket. Upon submitting, I want an email to be sent and for the page to refresh.
Update
I went through the php tutorial and tried to set up a custom domain
I don't know how to link this php project to my actual html page though. The only DNS record that I had trouble with is
Custom domain name SSL Security RecordType Data Alias
Google-managed, auto-renewing - CNAME ghs.googlehosted.com www
Because it clashes with this domain
Type Name Data TTl
CNAME www c.storage.googleapis.com 600 sec
I receive the following error when I change my cname record to the ghs one
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>The requested project was not found.</Details>
</Error>
Sorry for how confusing this edit is, I'm entirely confused as to what I've been doing with google cloud. I have a project in the storage bucket, and another project in the app engine, but I don't know how to either display my html in the app engine or how to execute my php project from my storage bucket.
Here's a picture of my DNS settings at godaddy
A picture of my php bucket list
A picture of the email me bucket
And a picture of the DNS setting google cloud listed under custom web address
Your server doesn't allow PHP scripts to be executed and renders it seemingly just a text. Check with your server provider how to fix this.