Please excuse my terrible formatting, I am teaching myself html, css, and php.
I have a folder on my WAMP www folder, with html, css, and php. I am trying to get the information inputed in the form to get sent to an email address. My html with css shows up fine on the localhost,however when I click the submit button the url on the localhost changes to the php file, but I get a "localhost refused to connect." Besides, well, everything, what am I doing wrong here?
This is the html file
<!DOCTYPE>
<html>
<link rel = "stylesheet" href = "css/text.css">
<body background="image/wallpaperbetter.jpg">
<p> //code
</p>
</body>
<div>
<form method = "post" name = "myemailform" action = "https://localhost/xxxx/form-to-email.php">
<label for="name">Name(optional):</label>
<input type = "text"><br>
<label for="Home">Home:</label>
<input type = "text"><br>
<label for="City">City:</label>
<input type = "text"><br>
<label for="State">State:</label>
<input type = "text"><br>
<label for="Zip Code">Zip Code:</label>
<input type = "text"><br>
<label for="Country">Country:</label>
<input type = "text"><br>
<input type = "submit" value = "submit">
</form>
</div>
</html>
This is the php file
<?php
if(!isset($_POST['submit']))
{
echo "error; you need to submit the form!";
}
//Collect input
$name = $_POST['name'];
$home = $_POST['Home'];
$city = $_POST['City'];
$state = $_POST['State'];
$zip_code = $_POST['Zip Code'];
$country = $_POST['Country'];
//Validate
if(empty($home)||empty($city)||empty($state)||empty($zip_code)||empty(country))
{
echo "Please enter all fields. (Name is Optional)";
}
$email_from = 'xxxx';
$email_subject = "New Submission";
$email_body = "New submission\nName:$name\nHome:$home\nCity:$city\nState:$state\nZip Code:$zip_code\nCountry:country"
$to = "xxxx";
$headers = "xxxx";
//Send the email
mail($to,$email_subject,$email_body);
?>
action = "https://localhost/xxxx/form-to-email.php"mean that it is supposed to go to your PHP file?<input name="city" type="text">But I could be wrong, there are a lot of nuances in HTML