I'm a complete noob about web development. I have an one page HTML template that I was trying to edit as per my requirements. It has a contact form that I want people to use to send me an email. I set my email address as $to, but when I was testing the contact form, it didn't send an email to my address. Rather than that, it took me to the page contact.php and I could see all the html and php code. I'm attaching the codes for the contact form. Can anyone tell me what could possibly go wrong and how to fix this issue? Thanks in advance.
HTML Code:
<form id="contact-form" name="contact-form" method="post" action="contact.php">
<div class="row-fluid">
<p class="span6"><input id="username" name="username" type="text" tabindex="1" value="" placeholder="Name (required)"></p>
<p class="span6"><input id="email" name="email" type="text" tabindex="2" value="" placeholder="E-mail (required)"></p>
</div>
<div class="row">
<p class="span6"><textarea id="message" name="message" tabindex="4" rows="6" placeholder="Message (required)"></textarea></p>
</div>
<div class="row">
<div class="span2">
<button id="sending" type="submit" class="btn btn-embossed btn-large btn-primary" data-send="Sending...">Submit</button>
</div>
</div>
</form>
PHP Code:
(Note to the author: You can start your PHP code below:)
<?php
?>
Please click on the link to see the code. I can't post an image as I am new here. https://i.stack.imgur.com/QPHYH.jpg