Multiple post or get

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multiple post or get

    My problem is i dont know to edit multiple sql in just one click. I search the web but i cant understand their c0des. Code something like this <form action=update.php method=post>
    <input type=text name=id[] > then the submit. Haha i dont understand what is the function of id[] please help..

    #2
    What do you want to do?

    Btw, try to make a multiple checkbox, search google for checkbox example
    Checkbox can carry multiple value so you can use array,
    you can view the value of the array using print_f, something like this

    PHP Code:
    print_f($_POST['id']); 
    Did I help you?
    You can help me too
    Your donations will help me finance my studies.

    Comment


      #3
      Why do you think people will help you if you are not able to understand a form, not able to explain us and not able to understand nor yourself.
      mysterio.al - programming is a functional art

      Comment


        #4
        PHP Code:
        foreach($_POST['id'] as $key=>$nid){ 
        echo 
        $nid.'<br/>'//change this line to mysql update 

        Added after 40 minutes:

        PHP Code:
        $sql "SELECT id FROM table WHERE field='".$field."' ORDER BY id";
        $items mysql_query($sql);
        echo 
        '<form action="update.php" method="post">';
        while (
        $item mysql_fetch_array($items))
           {
              echo 
        '<input type="text" name="id['.$item.'] >'
           }
        //rest of form here 
        Last edited by something else; 28.06.11, 22:32.

        Comment


          #5
          the syntax [] usually use for FOR loop..

          for example
          <input type="checkbox" name="uname[]">

          for(x=1,x>count,c++)
          {
          $username = $_POST['uname'];
          $username = $username[x];
          mysql_query = ("DELETE FROM ibwf_users WHERE name='".$username."'")
          }


          something like that you are going to use [] because you have to insert something inside to it to get the value of the INPUT in FOR LOOP..

          Comment


            #6
            Code:
            $username = $_POST['uname'];
            for(x=0,x<count($username),x++)
            {
            mysql_query = ("DELETE FROM ibwf_users WHERE name='".$username[$x]."'")
            }
            
            <input type="checkbox" name="uname[]">
            nice example, deleting username
            Did I help you?
            You can help me too
            Your donations will help me finance my studies.

            Comment


              #7
              Yah thanks to all of you.

              I will use this in a information system.

              Added after 42 minutes:

              Maybe you dont understand while others do. do not post if you cannot contribute. This site is for noob and not for very professionals like you. Were here to study and not to be insult by arogant peoples. Thank you for wasting your ****ing time here. Hehe
              Last edited by Jerson; 29.06.11, 10:25.

              Comment


                #8
                Originally posted by Jerson View Post
                Yah thanks to all of you.

                I will use this in a information system.

                Added after 42 minutes:

                Maybe you dont understand while others do. do not post if you cannot contribute. This site is for noob and not for very professionals like you. Were here to study and not to be insult by arogant peoples. Thank you for wasting your ****ing time here. Hehe
                Can't get what you mean?
                Did I help you?
                You can help me too
                Your donations will help me finance my studies.

                Comment


                  #9
                  [] is used in form as an array. You can pass multiple value by it using checkbox.

                  For ex.
                  Code:
                  <form>
                  <input type="checkbox" name="x" value=1 />
                  <input type="checkbox" name="x" value=2 />
                  <input type="checkbox" name="x" value=3 />
                  </form>
                  will give you only one of those all selected values but if you use name="x[]" in form then it will pass all those selected values as an array.
                  Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

                  Comment

                  Working...
                  X