I am a beginner in PHP. I am stuck on something that seems really easy. I built a website, and there is a page in the website where people can send me e-mail through a form. The problem is, I think form seems to fail creating $POST_['name']. Just read the codes and you'll understand what im saying.
<form action="?" method="post">
<div id="right">
<label for="name"> <input type="text" class="kutu" name="name" ></label><br />
<label for="email"> <input type="email" class="kutu" name="email" ></label><br />
<label for="subject"> <input type="text" class="kutu" name="subject" ></label><br />
</div>
<div id="left">
<p>Name: </p>
<p>Your Email Adress: </p>
<p>Subject: </p>
</div>
<div id="bottom">
<p>Your Message:</p><br />
<label for="message"><textarea name="message" rows="3" cols="60"> </textarea></label>
</div>
<input type="submit" id="tus" value="submit">
</form>
And here is the PHP
if (isset($POST_['name'])) {
$email = $POST_['email'];
$subject = $POST_['subject'];
$message = "From: " . $POST_['name'] . ", " . $POST_['email'] . "\n Message: " . $POST_['message'];
try {
mail("myEmailAdress@gmail.com", $subject, $message, " ");
unset($POST_['name']);
header("Location: success.php");
}
catch (PDOException $e)
{
include 'index.html';
exit();
}
exit();
}
include 'contact2.php';
When i submit my form, it takes me to contact2.php again, which tells me that POST_['name'] was never created in the first place.