0

<?php
 // check for submit
 if(filter_has_var(INPUT_POST, 'submit')){
  echo 'Submitted';
 }
?>
<!DOCTYPE html> 
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

 <title>Chad's Portfolio</title>
 <link rel="stylesheet" type="text/css" href="mainstyles.css">
 
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" 
integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" 
crossorigin="anonymous">

 
  <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
 integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" 
 crossorigin="anonymous">
 
 </head>
 
 <nav class="navbar sticky-top">
 <h1>Contact</h1>

  <ul class="nav justify-content-end">
    </li>
    <li class="nav-item">
   <a class="nav-link" href="resume.html">Resume</a>
    </li>
    <li class="nav-item">
   <a class="nav-link" href="skills.html">Skills</a>
    </li>
    <li class="nav-item">
   <a class="nav-link" href="about.html">About</a>
    </li>
    <li <li class="nav-item">
   <a class="nav-link" href="contact.html">Contact</a>
  </ul>
 </nav>

<body>

<!-- banner container Class -->
<div class="container-fluid">
 <div class="row"> 
  <div class="col-md-12">
   <div class="card mb-3">
   <img class="card-img-top" style="height: 240px"; src="images/cards/tech-banner.jpg" alt="Card image cap">
   </div>
  </div> <!-- End of card Class -->
 </div>
</div> <!-- End of banner container Class -->



<!-- Contact Form -->

<div class="container">
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"
 >
  <div class="form-group">
   <label>Name</label>
   <input type="text" name="name" class="form-control"
   value="">
  </div> <!-- end of form group name -->
  
  <div class="form-group">
   <label>Email</label>
   <input type="text" name="email" class="form-control"
   value="">
  </div> <!-- end of form group email -->
  
  <div class="form-group">
   <label>Message</label>
   <textarea name="Message" class="form-control"></textarea>
  </div> <!-- end of form group message -->
  
  <br>
  <button type="submit" name="submit" class="btn btn-primary">Submit</button>
  
 </form>
</div> <!-- end of container -->

<!-- End Contact Form-->



<div class="footer"> <!-- footer Class -->
 <div id="socMed"> <!-- fontAwesome Social Media icons div -->
 <ul>
  <li><a href="https://www.facebook.com/"><i class="fab fa-facebook-f" aria-hidden="true"></i></a></li>
  <li><a href="https://www.linkedin.com/in/chad-gayken-91bab1a1/"><i class="fab fa-linkedin-in" aria-hidden="true"></i></a></li>
  <li><a href="https://plus.google.com/u/0/"><i class="fab fa-google-plus-g" aria-hidden="true"></i></a></li>
 </ul>
 </div> <!-- End of fontAwesome Social Media icons div -->
</div> <!-- End of for footer Class -->

<!--  End of Social Media icons ID -->
  <script src="https://code.jquery.com/jquery-3.3.1.min.js"</script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
 </body>

</html>

I have contact page in html and am using PHP. I have a form that takes user's Name, Email Address and Message. I have a bootstrap 4 type of form to take the values. I am right now using windows 10 using XAMPP with Apache Server MySQL running.

The actual problem that I have is when I try to echo results "Submitted" when clicking on my contact form submit button, resulting in Access forbidden "You don't have permission to access the requested object. It is eather read-protected or not readable by the server." Below that its Error 403 localhost Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4 message.

What do I do to ensure that permissions are set? I am new to XAMPP, please keep this in mind. Note I have the contact page saved as contact.html, does it require it to be contact.php instead to run the script?

Chad_G
  • 23
  • 7
  • Possible duplicate of [Error 403 on form submit](https://stackoverflow.com/questions/2092056/error-403-on-form-submit) – Mwangi Njuguna Apr 29 '18 at 14:56
  • Check the source and see what the output of `` is – Capsule Apr 30 '18 at 02:52
  • Also, you could just leave the action attribute empty to avoid weird path issues and submit to the same page (which is obviously accessible), see https://stackoverflow.com/questions/14093316/why-use-serverphp-self-instead-of – Capsule Apr 30 '18 at 02:54
  • Oh yes, I forgot to include the server error, I'll be sure to add that once I get home to run the page again. – Chad_G May 01 '18 at 11:29

0 Answers0