I have looked at some similar questions asked on here but not had much luck. i am currently getting this error message which is sitting above my bootstrap contact form box. the error message appears before i click submit. i am rather new to php and in need of some help. Edit: My hosting does have mail capabilities
Notice: Undefined index: Lname in /web/users/m2105652/fyp/contact.php on line 7 Notice: Undefined index: email in /web/users/m2105652/fyp/contact.php on line 8 Notice: Undefined index: message in /web/users/m2105652/fyp/contact.php on line 9 Notice: Undefined variable: Fname in /web/users/m2105652/fyp/contact.php on line 13
Here is my php
if(isset($_POST['submit']))
$Fname = $_POST['Fname'];
$Lname = $_POST['Lname'];
$email = $_POST['email'];
$message = $_POST['message'];
$to = "myemail@gmail.com"; // <<< change this to your own E-mail address
$subject = "Contact From My Website";
$msg = "First Name: $Fname\n" . "Last Name: $Lname\n" . "Email: $email\n" . "Message: $message";
$headers = "From: $email" . "\r\n" .
"Reply-To: $email" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
mail($to, $subject, $msg, $headers);
?>
Here is my Html for the contact form
<form class="form-horizontal" method="post" action="contact.php">
<fieldset>
<legend class="text-center header">Contact us</legend>
<div class="form-group">
<span class="col-md-1 col-md-offset-2 text-center"><i class="fa fa-user bigicon"></i></span>
<div class="col-md-8">
<input id="Fname" name="name" type="text" placeholder="First Name" class="form-control">
</div>
</div>
<div class="form-group">
<span class="col-md-1 col-md-offset-2 text-center"><i class="fa fa-user bigicon"></i></span>
<div class="col-md-8">
<input id="Lname" name="name" type="text" placeholder="Last Name" class="form-control">
</div>
</div>
<div class="form-group">
<span class="col-md-1 col-md-offset-2 text-center"><i class="fa fa-envelope-o bigicon"></i></span>
<div class="col-md-8">
<input id="email" name="email" type="text" placeholder="Email Address" class="form-control">
</div>
</div>
<div class="form-group">
<span class="col-md-1 col-md-offset-2 text-center"><i class="fa fa-pencil-square-o bigicon"></i></span>
<div class="col-md-8">
<textarea class="form-control" id="message" name="message" placeholder="Enter your massage for us here. We will get back to you within 2 business days." rows="7"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-12 text-center">
<button type="submit" class="btn btn-lg btn-success btn-block">Submit</button>
</div>
</div>
</fieldset>
</form>