HI all just a quick thing. My page is throwing up an HTML 500 error when I boot up but I can't see whats wrong with my code at all. I am trying to create a contact form on my webpage that will simply take the details and email them to me when the user clicks the form. The page will simply not load with this code.
<form method="post">
<input type="text" name="contact-name" placeholder="Name." required>
<input type="email" name="contact-email" placeholder="Email." required>
<input type="text" name="contact-subject" placeholder="Subject." required>
<br><br>
<textarea name="contact-content"></textarea>
<div id="contact-btn-wrap">
<input type="submit" name="contact-submit" id="login-btn-signup" value="SEND EMAIL">
</div>
</form>
<br><br><br><br>
<div class="contact-me">danashton89@gmail.com | 07714709250</div>
</div>
</div>
<div class="contact-img">
<img src="/uploads/Portfolio/Level_Design/Unreal_Engine/Ice_Cove/icecastle_3.png">
</div>
<?php
$contact-name = "";
$contact-email = "";
$contact-subject = "";
$contact-content = "";
if (isset($_POST['contact-submit']))
{
$contact-name = mysqli_real_escape_string($con, $_POST['contact-name']);
$contact-email = mysqli_real_escape_string($con, $_POST['contact-email']);
$contact-subject = mysqli_real_escape_string($con, $_POST['contact-subject']);
$contact-content = mysqli_real_escape_string($con, $_POST['contact-content']);
$to = "danashton89@gmail.com";
$subject = $contact-subject;
$txt = $contact-content;
$headers = "From: " . $contact-name . "<br>" . $contact-email . "\r\n";
$headers.= "MIME-version: 1.0\n";
$headers.= "Content-type: text/html; charset= iso-8859-1\n";
mail($to,$subject,$txt,$headers);
}
?>
First, you cannot declare vars in php with '-'
Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
Second, your connection var is defined?
Last, can you provide the error string?