1

This is just a test page I am working on. Trying to get my submit button to load the next page "order.php"

It just keeps loading the same page. Should I be writing this in PHP or HTML?

If you look at my submit button, I am thinking this should work.

<?php 
   ini_set('display_errors',1);
   ini_set('display_startup_errors',1);
   error_reporting(-1);
   require_once('connect2db.php');


   if(isset($_POST["action"])){ 

          $customer = $_POST['customer'];
          $Email = $_POST['Email'];


          $query = "INSERT INTO tbl_cust 
                (CName, email)
             VALUES 
                (:customer, :Email)";

          $sth = $db->prepare($query);
          $sth->bindValue(':customer', $customer, PDO::PARAM_STR);
          $sth->bindValue(':Email', $Email, PDO::PARAM_STR);
          $sth->execute();

          echo 'Form Submitted and data saved!';
   }


 ?>
<!DOCTYPE html>
<html class="html" lang="en-US">
   <head>
      <meta http-equiv="Content-type" content="text/html;     <title>Home</title>
   </head>
   <body>
      <div class="clearfix" id="page">
         <form class="form-grp clearfix colelem" id="widgetu75" method="post" enctype="multipart/form-data" action="">
           <input type="hidden" name="action" value="submit-form">
            <label>Name:</label>
            <input class="wrapped-input" type="text" spellcheck="false" id="widgetu86_input" name="customer" tabindex="1"/>
            <label>Email:</label>
            <input class="wrapped-input" type="text" spellcheck="false" id="widgetu82_input" name="Email" tabindex="2"/>
            <input class="submit-btn NoWrap grpelem" id="u81-17" type="submit" value="Submit" href="order.php" target="_blank"" ttabindex="3"/>
         </form>
      </div>
   </body>
</html>
  • 2
    try changing your action from "" to "order.php" – cybernard Oct 11 '15 at 22:48
  • it worked. i'm a bonehead. :) – David Oct 12 '15 at 0:05
  • Glad I could help. I have made simple mistakes that way also. – cybernard Oct 12 '15 at 0:07
  • @cybernard better post your comment as answer, so it would be easier for other users to know that this question has been answered already. – artsylar Oct 19 '15 at 6:43
0

try changing your action from "" to "order.php"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.