2 Replies Latest reply on May 18, 2017 9:21 PM by BenPleysier

    "MethodNotAllowedError" / "POST is not allowed" - PHP woes

    thevisualedge1 Level 1

      Hey Dreamweaver geniuses--

       

      I've recently completed my first attempt at a "contact us" form using PHP.  When I test the form and click "submit",  I get this:

       

      {"code":"MethodNotAllowedError","message":"POST is not allowed"}

       

      My form code and PHP code are below.  Would appreciate any advice.  Oh--and does the webpage with the form need to be a PHP file?  Or can it be an HTML file that simply contains a form with a PHP action?  

       

      ********************************************

       

      FORM CODE

       

      <div id="contactBox">

        <form action="mailscript.php" method="post" enctype="multipart/form-data" name="contactForm" id="contactForm" title="Contact Form">

           <p><em>*Required field </em></p>

           <p>

             <input name="firstname" type="text" required class="label" id="firstname" placeholder="First Name*">

            

             <input name="lastname" type="text" required class="label" id="lastname" placeholder="Last Name*">

            

             <input name="email" type="email" required class="label" id="email" placeholder="Email address*">

            

             <input name="phone" type="text" required class="label" id="phone" placeholder="Phone*" />

            

             <select name="timezone" class="selectItem" id="timezone" title="Time Zone">

               <option>Time Zone</option>

               <option>Pacific</option>

               <option>Mountain</option>

               <option>Central</option>

               <option>Eastern</option>

               <option>Other</option>

             </select>

            

             <select name="besttime" class="selectItem" id="besttime">

               <option>Best Time To Call</option>

               <option>Morning</option>

               <option>Midday</option>

               <option>Afternoon</option>

               <option>Evening</option>

             </select>

       

             <select name="referral" required class="selectItem" id="referral">

               <option>How did you hear about us?</option>

               <option>Option 1</option>

               <option>Option 2</option>

               <option>Someone referred me</option>

             </select>

            

           </p>

            <input name="submit" type="submit" class="submitButton" id="submit" form="contactForm" formaction="mailscript.php" formenctype="multipart/form-data" formmethod="POST" title="Submit" value="Submit">

          

         </form>

      </div>

       

       

      *************************************

       

      CODE FOR "mailscript.php"

       

      <?php

       

      $from="noreply@domain.com";

      $email="info@domain.com";

      $subject="SUBMISSION";

      $firstname=$_POST['firstname'];

      $lastname=$_POST['lastname'];

      $their_email=$_POST['email'];

      $phone=$_POST['phone'];

      $timezone=$_POST['timezone'];

      $besttime=$_POST['besttime'];

      $referral=$_POST['referral'];

       

      mail ($email, $subject, "From:".$from)

       

      ?>