So whenever i press submit it opens the browser showing the code.. what can i do? I watched a lot of youtube videos but i can't figure out. I downladed wampp, set the path but it still does not work. It's the first time i used php so i don't really have any type of experience with it. Can you help me please? It's the last step to completing my portfolio.
Homepage.html:
<form action="contactform.php" method="POST">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col123 col12">
<label for="">First Name </label>
<input type="text" name="fname" required>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col123 col12">
<label for="">Last Name </label>
<input type="text" name="sname" required>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col123 col12">
<label for="">Email</label>
<input type="email" name="email" required>
</div>
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col123 col12">
<label for="">Phone Number</label>
<input type="number" name="number" required>
</div>
<div class="col-lg-12 col-xl-12 col-md-12 col-sm-12 col123">
<label for="">Message</label>
<textarea name="message" id="" style="resize: vertical;"
placeholder="Write your message here ... " required></textarea>
</div>
<div class="col-lg-12 col-xl-12 col-md-12 col-sm-12 col44">
<button type="submit" name="send" role="button" id="button">
Send
</button>
</div>
</div>
</form>
contactform.php:
<?php
if(isset($_POST["send"])){
$fname = $_POST['fname'];
$sname = $_POST['sname'];
$number = $_POST['number'];
$mailFrom = $_POST['mail'];
$message = $_POST['message'];
$mailTo = "bogdybogdan34@gmail.com";
$headers = "From: ".$mailFrom;
$txt = "You have received and e-mail from ".$sname."\n".$number."\n\n".$message;
mail($mailTo , $txt , $headers);
header("Location: homepage.html?mailsend");
}
?>