handle multiple related form on one page, urgent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fariba123
    New Member
    • Oct 2006
    • 17

    handle multiple related form on one page, urgent

    i have a table that contains product details. i have a form with a textbox that takes product name as input. as soon as the submit button is clicked the product name as submitted has to be shown bellow the first form (in same page). everytime i click the submit button the product name as entered has to be shown below along with the previous product names.

    i have done it for the first submit. i don't know how to append the product name after second submission and so on.

    can you please suggest any way out or any code example.

    thanks in advance.

    fariba
  • mmarif4u
    New Member
    • Sep 2006
    • 23

    #2
    HI,,,

    Can u please show the code.And reshape ur q with clearity..

    Thanks.

    Comment

    • fariba123
      New Member
      • Oct 2006
      • 17

      #3
      <html>
      <head>
      <title>Untitl ed Document</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      </head>

      <body>
      <form action="testInv entory.php" method="post">
      <input type="hidden" name="ctr" value="<?=$ctr; ?>">
      Search Product Info ! ! !<br><br>
      Product Name <input type="text" name="pn" id="pn" value="<?=$pn; ?>">
      <br><input name="submit" type="submit" id="submit" value="Submit">

      </form>
      <?php
      if(isset($_POST['submit'])){

      ?>
      <form action="testInv entory.php" method="post">
      <input type="hidden" name="pn" value="<?=$pn; ?>">
      <?php
      //echo "<br>succes s: ".$pn."/";

      include 'connecttutoria l.php';

      $s="SELECT DISTINCT p_name FROM inv WHERE p_name LIKE '$pn%' order by p_name";
      //echo "<br>s: ".$s;
      $result = mysql_query($s) ;
      $num_rows2 = mysql_num_rows( $result);
      //echo "<br>num_ro ws2: ".$num_rows 2."/";

      //$myrow2=mysql_f etch_row($resul t);
      if($num_rows2!= 0){
      $hint="";
      while($FetchSQL =mysql_fetch_ar ray($result))
      {?>
      <input type="checkbox" name="s_net[]" value="<?=$Fetc hSQL["p_name"]; ?>" ><? echo $FetchSQL["p_name"]." ";
      }
      ?>
      <br><input name="submitn" type="submit" id="submitn" value="Submit">
      </form>
      <?php
      }
      else{
      echo "<br>no suggestion";
      }
      }
      ?>
      </body>
      </html>

      Comment

      • mmarif4u
        New Member
        • Sep 2006
        • 23

        #4
        u r searching ur db, not inserting data...
        ok so u want that all the data showed in one page...

        Remove distinct from select statement then see what are the results...

        Comment

        • fariba123
          New Member
          • Oct 2006
          • 17

          #5
          thanks for the suggestion but it won't make any difference.

          what i need is for example:
          i will enter pe and click submit. what i will see is: pen pencil (below the form).

          next time i will enter sh and click submit. what i will see is: pen pencil sharpner(below the form).

          the process will continue unless i get all my desired product names.

          i hope you understand what i want. i want to append product name everytime i click submit. you may have noticed that i have included checkbox. it is because, after i am done with all the desired product name i will select checkbox (s) to view the product details of the checked products.

          hope to get a quick and helpful reply.

          thanks

          fariba

          Comment

          • mmarif4u
            New Member
            • Sep 2006
            • 23

            #6
            The best way for this in my mind is to store ur data which u want to
            display in the page to a temp table in the db,then display it from that
            table,,,
            For example:
            Make new table with protemp,make fields which u want to display
            ,when u search one by one the data will comeout, with the stored one...

            May be this will work,, i am not sure
            u can try it...

            Good Luck..

            Comment

            Working...