0

I want to add a contact form on my page but I've never worked with PHP before. I need help, please?

I'm working with the form below:

<a name="Contact"></a>
<div class="contact">
<div class="container">
<div class="row">
<div class="col-lg-8">
<h1 class="page-header text-center">Get in touch!</h1>
<form class="form-horizontal" role="form" method="post" action="index.php">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" name="name" placeholder="First & Last Name" value="<?php echo htmlspecialchars($_POST['name']); ?>">
<?php echo "<p class='text-danger'>$errName</p>";?>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" name="email" placeholder="example@domain.com" value="<?php echo htmlspecialchars($_POST['email']); ?>">
<?php echo "<p class='text-danger'>$errEmail</p>";?>
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="4" name="message"><?php echo htmlspecialchars($_POST['message']);?></textarea>
<?php echo "<p class='text-danger'>$errMessage</p>";?>
</div>
</div>
<div class="form-group">
<label for="human" class="col-sm-2 control-label">2 + 3 = ?</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="human" name="human" placeholder="Your Answer">
<?php echo "<p class='text-danger'>$errHuman</p>";?>
</div>
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
<input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-sm-offset-2">
<?php echo $result; ?>  
</div>
</div>
</form>
</div>

For for some reason, it's not displaying properly. This is how it looks:

screenshot of contact form

Stef
  • 1
  • 1
  • 1
    that file is either `.html` or you didn't install a webserver/PHP or you're not running it correctly. – Funk Forty Niner Apr 03 '16 at 18:08
  • 1
    possible duplicate of [PHP code is not being executed I can see it on source code of page](http://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-i-can-see-it-on-source-code-of-page) – Funk Forty Niner Apr 03 '16 at 18:09
  • How do I install a PHP? @Fred-ii- – Stef Apr 04 '16 at 01:17
  • Just google run php on whatever server you are using! You can make html document on your desktop but you need a server to handle php. – MadeInDreams Apr 13 '16 at 03:08

0 Answers0