Loading ...
Sorry, an error occurred while loading the content.

Re: [phpResource] form on the fly

Expand Messages
  • Mohamed BADR
    I used this $collegeName=$_POST[ college ]; print_r($collegeName); and it gave me this printed Array ( [0] = 10 [1] = 20 [2] = 15 [3] = 10 ) so it gave me
    Message 1 of 11 , May 31, 2006
    • 0 Attachment
      I used this
       
      $collegeName=$_POST['college'];
      print_r($collegeName); 
       
       
      and it gave me this printed
       
      Array ( [0] => 10 [1] => 20 [2] => 15 [3] => 10 )
       
      so it gave me the array printed but what i need is values from the array each one assigned to variable name
      so i will insert each variable in the database
      so here this array is giving the right results but i still can't put them in the database
      Mohamed BADR
      Senior Web/Database developer
      PHP/MySql/ Oracle  -  ASP.NET/SQL - multimedia
      OMEGA SOFT
      0102050009
      ----- Original Message -----
      Sent: Wednesday, May 31, 2006 4:36 AM
      Subject: Re: [phpResource] form on the fly



      Mohamed BADR <badr@...> wrote:
       
      when u get the variable value na..
      $collegeName=$_POST['college'];
      print_r($collegeName);              /// this gives u the whole array
       
       
      for($p=0;$p<count($collegeName);$p++){
       
      echo $collegeName[$p];              // this gives u the college name what
                                                         // whatever u selected in form
       
      }
       
       
       
       
       
       
       
       
       
      i tried your way but i still don't know how many variables sent in that array
      so now i can print print"$collegeName[1]";
      i don't know how to print all variables in that array because i don't know their number !!!
      here is my code now
       
       
      first (form)  page
       
      <?       
      $adding = "$wishes";
      for($addcount = 1; $addcount <= $adding; $addcount++)
      {
      ?>
                               
                                 <tr>
                                  <td width="33%" bgcolor="#E7F2FA"><? print($addcount);?></td>
                                  <td width="67%" bgcolor="#E7F2FA">
        <?php
       $conn = oci_connect("$username", "$password", "$server");if (!$conn) {
         $e = oci_error();
         print htmlentities($e['message']);
         exit;
        }
       
       ?>
      <SELECT   name="college[]" >
        
           
      <?php
      $query = "select COMP_ID, COMP_NAME from SEC_COMP where COMP_ID in (select COMP_ID from ACD_FACULTY_STUDY
      where STUDY_CODE = '$CURRENT_STUDY' AND GRP_COMP_ID = '$cur_group_comp_id')";
      $statement = oci_parse ($conn, $query);
      oci_execute ($statement);
       
      while ($row = oci_fetch_array ($statement, OCI_NUM)) {
         ?><option value="<?  echo $row[0]; ?>">
         <? echo $row[1] ?> </option>
      <? }
      ?></select>
       
       
      and in the second page
       
       
      $collegeName=$_POST[college];
      print"$collegeName[1]";
       
       
       
       
       
       
      Mohamed BADR
      Senior Web/Database developer
      PHP/MySql/ Oracle  -  ASP.NET/SQL - multimedia
      OMEGA SOFT
      0102050009
      ----- Original Message -----
      Sent: Wednesday, May 31, 2006 3:37 AM
      Subject: Re: [phpResource] form on the fly


      You can take the array of the that valriable in html of the the select field
      like
      <select name=college[]>
      <option></option>
      </select >
       
      <select name=college[]>
      <option></option>
      </select >
       
       
      <select name=college[]>
      <option></option>
      </select >
       
      may be two or three or four.....
       
      And when form is submit u get the value of the element
      $collegeName=$_POST[college];
       
      so this new varibale collegeName is get An array of element college
       
       

      Mohamed BADR <badr@...> wrote:
      hi everybody
       
      here is a new problem i think it's easy but i don't know the clue
      i am creating a form fields on the fly according to a certain number in the database
      so if that number $wishes = 4 then there will be a 4 select feilds in the database and if 3 it will be 3 and so on
      the code for drawing the form works ok but the problem is how to get the data from the  form on the fly, i mean how i know that there's 4 variables and give each one a name to be put in the database later ???
      here is my code
       
       
       
       <form action="adm5.php" method="post" name="formp" enctype="multipart/form-data">
                            </tr>
              
      <?       
      $adding = "$wishes";
      for($addcount = 1; $addcount <= $adding; $addcount++)
      {
      ?> 
                        <tr>
                                  <td width="33%" bgcolor="#E7F2FA"><? print($addcount);?></td>
                                  <td width="67%" bgcolor="#E7F2FA">
        
      <?php 
      // connect to database
       $conn = oci_connect("$username", "$password", "$server");if (!$conn) {
         $e = oci_error();
         print htmlentities($e['message']);
         exit;
        }
       
       ?>
      <SELECT   name="college<? print($addcount);?>" >
              
      <?php
      $query = "select COMP_ID, COMP_NAME from SEC_COMP where COMP_ID in (select COMP_ID from ACD_FACULTY_STUDY
      where STUDY_CODE = '$CURRENT_STUDY' AND GRP_COMP_ID = '$cur_group_comp_id')";
      $statement = oci_parse ($conn, $query);
      oci_execute ($statement);
       
      while ($row = oci_fetch_array ($statement, OCI_NUM)) {
         ?><option value="<?  echo $row[0]; ?>">
         <? echo $row[1] ?> </option>
      <? }
      ?></select> </td>
                                  </tr>
             
              <? } ?>
       
      </form>
       
       
       
       
       
      Mohamed BADR


      Yahoo! India Answers: Share what you know. Learn something new Click here
      Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now


      Yahoo! India Answers: Share what you know. Learn something new Click here
      Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now

    • Mohamed BADR
      hi there anybody knows a good tutorials about AJAX with php ??? please show me some links thnx Mohamed BADR Senior Web/Database developer PHP/MySql/ Oracle -
      Message 2 of 11 , Jun 10, 2006
      • 0 Attachment
        hi there
        anybody knows a good tutorials about AJAX with php ???
        please show me some links
        thnx
        Mohamed BADR
        Senior Web/Database developer
        PHP/MySql/ Oracle  -  ASP.NET/SQL - multimedia
        OMEGA SOFT
        0102050009
        ----- Original Message -----
        Sent: Wednesday, May 31, 2006 4:31 AM
        Subject: Re: [phpResource] form on the fly

        sorry didn't read your given code.
        i didn't get your problem.
        but some what i think you are expecting is like this...


        <?
        for($i=0;$i<count($acc)
        ?>
        <select name="test_<?=$i?>">
        <option value=""></option>
        </select>
        <?
        }
        ?>
        if you want the primary key from array $wishes you can use

        <?
        for($i=0;$i<count($acc);$i++)
        ?>
        <select name="field_<?=$acc[$i][primarykey]?>">
        <option value=""></option>
        </select>
        <?
        }
        ?>

        On 5/31/06, Mohamed BADR <badr@...> wrote:
        hi Aniruddha
         
        i don't understand, i already have the form created fields according to the number in the database, with each field named college + number like that
        <SELECT   name="college<? print($addcount);?>" >
        how can i print variables coming out of that form ??
        that's my question
         
        Mohamed BADR
         
        ----- Original Message -----
        Sent: Wednesday, May 31, 2006 3:22 AM
        Subject: Re: [phpResource] form on the fly

        Hi Mohamed,
        you can just take a hidden field & set how many fields are there in the form which you can set from the database value.

        or

        you can query it again when form posts for how many fields to print.
        you can print the fields like

        field_1
        field_2
        .
        .
        .
        field_n
        & access these fields when form posts!

        hope this will solve your prob.


        On 5/31/06, Mohamed BADR <badr@...> wrote:
        hi everybody
         
        here is a new problem i think it's easy but i don't know the clue
        i am creating a form fields on the fly according to a certain number in the database
        so if that number $wishes = 4 then there will be a 4 select feilds in the database and if 3 it will be 3 and so on
        the code for drawing the form works ok but the problem is how to get the data from the  form on the fly, i mean how i know that there's 4 variables and give each one a name to be put in the database later ???
        here is my code
         
         
         
         <form action="adm5.php" method="post" name="formp" enctype="multipart/form-data">
                              </tr>
                
        <?       
        $adding = "$wishes";
        for($addcount = 1; $addcount <= $adding; $addcount++)
        {
        ?> 
                          <tr>
                                    <td width="33%" bgcolor="#E7F2FA"><? print($addcount);?></td>
                                    <td width="67%" bgcolor="#E7F2FA">
          
        <?php 
        // connect to database
         $conn = oci_connect("$username", "$password", "$server");if (!$conn) {
           $e = oci_error();
           print htmlentities($e['message']);
           exit;
          }
         
         ?>
        <SELECT   name="college<? print($addcount);?>" >
                
        <?php
        $query = "select COMP_ID, COMP_NAME from SEC_COMP where COMP_ID in (select COMP_ID from ACD_FACULTY_STUDY
        where STUDY_CODE = '$CURRENT_STUDY' AND GRP_COMP_ID = '$cur_group_comp_id')";
        $statement = oci_parse ($conn, $query);
        oci_execute ($statement);
         
        while ($row = oci_fetch_array ($statement, OCI_NUM)) {
           ?><option value="<?  echo $row[0]; ?>">
           <? echo $row[1] ?> </option>
        <? }
        ?></select> </td>
                                    </tr>
               
                <? } ?>
         
        </form>
         
         
         
         
         
        Mohamed BADR



        -------------------------------------------
        Keep Yourself Here and Enjoy PHPing.




        SPONSORED LINKS
        Computer storeProgramming languagesOnline computer store
        Apple computer storeComputer store business planDell computer store


        YAHOO! GROUPS LINKS






        --
        Thanx
        Brest Regards
        Aniruddha Deshpande


        -------------------------------------------
        Keep Yourself Here and Enjoy PHPing.




        SPONSORED LINKS
        Computer storeProgramming languagesOnline computer store
        Apple computer storeComputer store business planDell computer store


        YAHOO! GROUPS LINKS






        --
        Thanx
        Brest Regards
        Aniruddha Deshpande
      • Khaled Al-Shamaa
        Dear Badr, I like one simple introduction sent as an email for some one and titled as Mail by Rasmus about AJAX and you can found it in many places in the
        Message 3 of 11 , Jun 11, 2006
        • 0 Attachment
          Dear Badr,

          I like one simple introduction sent as an email for some one and titled as "Mail by Rasmus about AJAX" and you can found it in many places in the Internet, one of those places is here:

          http://www.al-shamaa.com/?p=106

          Best regards,
          Khaled

          On 6/11/06, Mohamed BADR <badr@... > wrote:

          hi there
          anybody knows a good tutorials about AJAX with php ???
          please show me some links
          thnx
          Mohamed BADR
          Senior Web/Database developer
          PHP/MySql/ Oracle  -  ASP.NET/SQL - multimedia
          OMEGA SOFT
          0102050009
          ----- Original Message -----
          Sent: Wednesday, May 31, 2006 4:31 AM
          Subject: Re: [phpResource] form on the fly

          sorry didn't read your given code.
          i didn't get your problem.
          but some what i think you are expecting is like this...


          <?
          for($i=0;$i<count($acc)
          ?>
          <select name="test_<?=$i?>">
          <option value=""></option>
          </select>
          <?
          }
          ?>
          if you want the primary key from array $wishes you can use

          <?
          for($i=0;$i<count($acc);$i++)
          ?>
          <select name="field_<?=$acc[$i][primarykey]?>">
          <option value=""></option>
          </select>
          <?
          }
          ?>

          On 5/31/06, Mohamed BADR <badr@...> wrote:
          hi Aniruddha
           
          i don't understand, i already have the form created fields according to the number in the database, with each field named college + number like that
          <SELECT   name="college<? print($addcount);?>" >
          how can i print variables coming out of that form ??
          that's my question
           
          Mohamed BADR
           
          ----- Original Message -----
          Sent: Wednesday, May 31, 2006 3:22 AM
          Subject: Re: [phpResource] form on the fly

          Hi Mohamed,
          you can just take a hidden field & set how many fields are there in the form which you can set from the database value.

          or

          you can query it again when form posts for how many fields to print.
          you can print the fields like

          field_1
          field_2
          .
          .
          .
          field_n
          & access these fields when form posts!

          hope this will solve your prob.


          On 5/31/06, Mohamed BADR <badr@...> wrote:
          hi everybody
           
          here is a new problem i think it's easy but i don't know the clue
          i am creating a form fields on the fly according to a certain number in the database
          so if that number $wishes = 4 then there will be a 4 select feilds in the database and if 3 it will be 3 and so on
          the code for drawing the form works ok but the problem is how to get the data from the  form on the fly, i mean how i know that there's 4 variables and give each one a name to be put in the database later ???
          here is my code
           
           
           
           <form action="adm5.php" method="post" name="formp" enctype="multipart/form-data">
                                </tr>
                  
          <?       
          $adding = "$wishes";
          for($addcount = 1; $addcount <= $adding; $addcount++)
          {
          ?> 
                            <tr>
                                      <td width="33%" bgcolor="#E7F2FA"><? print($addcount);?></td>
                                      <td width="67%" bgcolor="#E7F2FA">
            
          <?php 
          // connect to database
           $conn = oci_connect("$username", "$password", "$server");if (!$conn) {
             $e = oci_error();
             print htmlentities($e['message']);
             exit;
            }
           
           ?>
          <SELECT   name="college<? print($addcount);?>" >
                  
          <?php
          $query = "select COMP_ID, COMP_NAME from SEC_COMP where COMP_ID in (select COMP_ID from ACD_FACULTY_STUDY
          where STUDY_CODE = '$CURRENT_STUDY' AND GRP_COMP_ID = '$cur_group_comp_id')";
          $statement = oci_parse ($conn, $query);
          oci_execute ($statement);
           
          while ($row = oci_fetch_array ($statement, OCI_NUM)) {
             ?><option value="<?  echo $row[0]; ?>">
             <? echo $row[1] ?> </option>
          <? }
          ?></select> </td>
                                      </tr>
                 
                  <? } ?>
           
          </form>
           
           
           
           
           
          Mohamed BADR



          -------------------------------------------
          Keep Yourself Here and Enjoy PHPing.




          SPONSORED LINKS
          Computer store Programming languages Online computer store
          Apple computer store Computer store business plan Dell computer store


          YAHOO! GROUPS LINKS






          --
          Thanx
          Brest Regards
          Aniruddha Deshpande


          -------------------------------------------
          Keep Yourself Here and Enjoy PHPing.




          SPONSORED LINKS
          Computer store Programming languages Online computer store
          Apple computer store Computer store business plan Dell computer store


          YAHOO! GROUPS LINKS






          --
          Thanx
          Brest Regards
          Aniruddha Deshpande


        • Ehsan Haque
          Hi Mohamed, Here are some links that might be helpful. I m not much in Ajax as yet, but think these might be good to look at:
          Message 4 of 11 , Jun 11, 2006
          • 0 Attachment
            Hi Mohamed,

            Here are some links that might be helpful. I'm not much in Ajax as
            yet, but think these might be good to look at:

            http://www.w3schools.com/ajax/default.asp
            http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html

            There are lots more than two. Search on Google with keywords ajax php
            tutorial OR example

            Also if you find any good link, please add that to Links section.

            Thanks


            --- In phpresource@yahoogroups.com, "Mohamed BADR" <badr@...> wrote:
            >
            > hi there
            > anybody knows a good tutorials about AJAX with php ???
            > please show me some links
            > thnx
            > Mohamed BADR
            > Senior Web/Database developer
            > PHP/MySql/ Oracle - ASP.NET/SQL - multimedia
            > OMEGA SOFT
            > 0102050009
            > ----- Original Message -----
            > From: Aniruddha Deshpande
            > To: phpresource@yahoogroups.com
            > Sent: Wednesday, May 31, 2006 4:31 AM
            > Subject: Re: [phpResource] form on the fly
            >
            >
            > sorry didn't read your given code.
            > i didn't get your problem.
            > but some what i think you are expecting is like this...
            >
            >
            > <?
            > for($i=0;$i<count($acc)
            > ?>
            > <select name="test_<?=$i?>">
            > <option value=""></option>
            > </select>
            > <?
            > }
            > ?>
            > if you want the primary key from array $wishes you can use
            >
            > <?
            > for($i=0;$i<count($acc);$i++)
            > ?>
            > <select name="field_<?=$acc[$i][primarykey]?>">
            > <option value=""></option>
            > </select>
            > <?
            > }
            > ?>
            >
            >
            > On 5/31/06, Mohamed BADR <badr@...> wrote:
            > hi Aniruddha
            >
            > i don't understand, i already have the form created fields
            according to the number in the database, with each field named college
            + number like that
            > <SELECT name="college<? print($addcount);?>" >
            >
            > how can i print variables coming out of that form ??
            > that's my question
            >
            > Mohamed BADR
            >
            >
            > ----- Original Message -----
            > From: Aniruddha Deshpande
            > To: phpresource@yahoogroups.com
            > Sent: Wednesday, May 31, 2006 3:22 AM
            > Subject: Re: [phpResource] form on the fly
            >
            >
            > Hi Mohamed,
            > you can just take a hidden field & set how many fields are
            there in the form which you can set from the database value.
            >
            > or
            >
            > you can query it again when form posts for how many fields to
            print.
            > you can print the fields like
            >
            > field_1
            > field_2
            > .
            > .
            > .
            > field_n
            > & access these fields when form posts!
            >
            > hope this will solve your prob.
            >
            >
            >
            > On 5/31/06, Mohamed BADR <badr@...> wrote:
            > hi everybody
            >
            > here is a new problem i think it's easy but i don't know the
            clue
            > i am creating a form fields on the fly according to a
            certain number in the database
            > so if that number $wishes = 4 then there will be a 4 select
            feilds in the database and if 3 it will be 3 and so on
            > the code for drawing the form works ok but the problem is
            how to get the data from the form on the fly, i mean how i know that
            there's 4 variables and give each one a name to be put in the database
            later ???
            > here is my code
            >
            >
            >
            > <form action="adm5.php" method="post" name="formp"
            enctype="multipart/form-data">
            > </tr>
            >
            > <?
            > $adding = "$wishes";
            > for($addcount = 1; $addcount <= $adding; $addcount++)
            > {
            > ?>
            > <tr>
            > <td width="33%"
            bgcolor="#E7F2FA"><? print($addcount);?></td>
            > <td width="67%" bgcolor="#E7F2FA">
            >
            > <?php
            > // connect to database
            > $conn = oci_connect("$username", "$password", "$server");if
            (!$conn) {
            > $e = oci_error();
            > print htmlentities($e['message']);
            > exit;
            > }
            >
            > ?>
            >
            > <SELECT name="college<? print($addcount);?>" >
            >
            > <?php
            > $query = "select COMP_ID, COMP_NAME from SEC_COMP where
            COMP_ID in (select COMP_ID from ACD_FACULTY_STUDY
            > where STUDY_CODE = '$CURRENT_STUDY' AND GRP_COMP_ID =
            '$cur_group_comp_id')";
            > $statement = oci_parse ($conn, $query);
            > oci_execute ($statement);
            >
            > while ($row = oci_fetch_array ($statement, OCI_NUM)) {
            > ?><option value="<? echo $row[0]; ?>">
            > <? echo $row[1] ?> </option>
            > <? }
            > ?></select> </td>
            > </tr>
            >
            > <? } ?>
            >
            > </form>
            >
            >
            >
            >
            >
            > Mohamed BADR
            >
            >
            >
            >
            > -------------------------------------------
            > Keep Yourself Here and Enjoy PHPing.
            >
            >
            >
            > SPONSORED LINKS Computer store Programming languages
            Online computer store
            > Apple computer store Computer store business plan
            Dell computer store
            >
            >
            > ------------------------------------------------------------------------
            > YAHOO! GROUPS LINKS
            >
            > a.. Visit your group "phpresource" on the web.
            >
            > b.. To unsubscribe from this group, send an email to:
            > phpresource-unsubscribe@yahoogroups.com
            >
            > c.. Your use of Yahoo! Groups is subject to the Yahoo!
            Terms of Service .
            >
            >
            > ------------------------------------------------------------------------
            >
            >
            >
            >
            > --
            > Thanx
            > Brest Regards
            > Aniruddha Deshpande
            >
            >
            > -------------------------------------------
            > Keep Yourself Here and Enjoy PHPing.
            >
            >
            >
            > SPONSORED LINKS Computer store Programming languages Online
            computer store
            > Apple computer store Computer store business plan Dell
            computer store
            >
            >
            >
            --------------------------------------------------------------------------
            > YAHOO! GROUPS LINKS
            >
            > a.. Visit your group "phpresource" on the web.
            >
            > b.. To unsubscribe from this group, send an email to:
            > phpresource-unsubscribe@yahoogroups.com
            >
            > c.. Your use of Yahoo! Groups is subject to the Yahoo!
            Terms of Service .
            >
            >
            >
            --------------------------------------------------------------------------
            >
            >
            >
            >
            > --
            > Thanx
            > Brest Regards
            > Aniruddha Deshpande
            >
            >
            > -------------------------------------------
            > Keep Yourself Here and Enjoy PHPing.
            >
            >
            >
            > SPONSORED LINKS Computer store Programming languages Online
            computer store
            > Apple computer store Computer store business plan Dell
            computer store
            >
            >
            >
            ------------------------------------------------------------------------------
            > YAHOO! GROUPS LINKS
            >
            > a.. Visit your group "phpresource" on the web.
            >
            > b.. To unsubscribe from this group, send an email to:
            > phpresource-unsubscribe@yahoogroups.com
            >
            > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            Service.
            >
            >
            >
            ------------------------------------------------------------------------------
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.