1 Reply Latest reply on Sep 26, 2008 6:10 PM by ntsiii

    Multiple forms only inserts data from first one

    ErnestX
      Can anyone help? i've rechecked and i can't find the problem
      My first state inserts data without any problem, when completed it redirects to state 2, where a second form is to be filled. This form inserts blanks. PHP and MySql is used.
      Inspecting the MySql log this is the query i get: INSERT INTO badideas VALUES ('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
      I check the number of fields and it is correct.

      PHP code> request_post2a.php
      <?php
      define( "DATABASE_SERVER", "localhost" );
      define( "DATABASE_USERNAME", "thistextchanged" );
      define( "DATABASE_PASSWORD", "thistextchanged" );
      define( "DATABASE_NAME", "badcampaign" );
      $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);

      if ($_POST['CompanyName'] <> "") {
      //add the user
      $querysql1 = "INSERT INTO setup VALUES ('', '".$_POST['CompanyName']."', '".$_POST['Coordinator']."', '".$_POST['Location']."', '')";
      $query1 = mysql_query( $querysql1 ) or die(mysql_error());
      }


      $querysql3 = "INSERT INTO badideas VALUES ('', '".$_POST['Identifier2']."', '".$_POST['Submitter']."', '".$_POST['SubmissionDate']."', '".$_POST['Category']."', '".$_POST['Summary']."', '".$_POST['Details']."', '".$_POST['Savings']."', '".$_POST['PotencialRevenue']."', '".$_POST['Priority']."', '".$_POST['RevenueStatus']."', '".$_POST['Team']."', '".$_POST['Disposition']."', '".$_POST['DispositionDate']."', '".$_POST['Revenue']."', '".$_POST['SavingsStatus']."', '".$_POST['Benefits']."', '".$_POST['Implementer']."', '".$_POST['ReferralDate']."', '".$_POST['ImplementationDate']."', '".$_POST['Comments']."')";

      $query3 = mysql_query( $querysql3 ) or die(mysql_error());


      $querysql2 = "SELECT * FROM setup ORDER BY Id DESC LIMIT 0,1;";
      $result1 = mysql_query($querysql2, $mysql) or die(mysql_error());
      $setup = mysql_fetch_array($result1) or die(mysql_error());

      print "<options><option><CompanyName>".$setup['CompanyName']."</CompanyName><Coordinator>".$set up['Coordinator']."</Coordinator><Location>".$setup['Location']."</Location></option></opt ions>";
      ?>


      Thanks in advance
        • 1. Re: Multiple forms only inserts data from first one
          ntsiii Level 3
          Ug, don't use states for complex stuff like that.

          Use a ViewStack.

          Further advice:
          * Use a single HTTPService instance
          * Build your request object in AS so you can debug it. Why are your insert values empty? Using declarative binding syntax, you are mostly stuck with prayer to find out.
          * Use AsyncToken to relate a specific call to its result.

          Below are some example snippets.

          Tracy