Hi,

This code is within a loop where i am selecting (multiple) country and specialty from database.
In the table with other data pulling, i want to input some values from the user under this code and i am performing some formula on the $sample in Sends Necessary.php file

  $sample=$_GET['sample'];
  echo "<td>";
echo "<form action=\"Sends Necessary.php\" method=\"GET\">
<input type='number' name='sample' value='$sample'>";
   echo "</td>";

 $_SESSION["sample"]=$sample; 

Now my problem is when it is single selection of country and specialty then this works but when i select multiple values then it only remember the last value input.
Please help me with this.

Many Thanks

    It's hard to tell exactly what you're looking for from the limited code you provided, but I have a feeling you are trying to do something similar to checkboxes. Here's an example of what to do for checkboxes (http://www.webmasterworld.com/forum88/11963.htm). Basically, if you have a form with multiple inputs with the same name:

     <INPUT type="checkbox" name="assistivetech[]" value="Interpretype">Interpretype<BR>
    <INPUT type="checkbox" name="assistivetech[]" value="Large Print Internet Monitor">Large Print Internet Monitor<BR>
    <INPUT type="checkbox" name="assistivetech[]" value="Video Eye">Video Eye<BR> 

    Then you can display them like this:

     for ($i=0; $i<count($_POST['assistivetech']); $i++){
    $assistivetech_req = addslashes($_POST['assistivetech'][$i]);
    //do this
    //do that
    }//end loop 

    It might not apply directly to what you're doing, but you can probably change your form to work this way. If this doesn't help, you need to post more code.

      No ,I am not trying to input checkboxes but like as an exapmle above of coding ,how can i input 3 times value in the above code as an exapmle in one row, user input
      34 in the text and in the other row user input 67,when i perform operations on $sample it only remembers 67 and display 67 in both rows and in the results for 67 on both rows.

      but when i perform it for 1 row it works.
      so i want to store more then 1 row input into $sample

        Did you look over the Weedpacket`s post?

          22 days later

          Yes ,but my questions is not clear i think, let try once again what i am trying to do...

          Suppose from this code

          echo "<form action=\"Sends Necessary.php\" method=\"GET\"> 
          <input type='number' name='sample' value='$sample'>"; 
             echo "</td>";

          I am asking for a textbox of type number right, but i am only getting one variable through $sample, due to which when i input any number it remembers that but

          hidden part is i am pulling this in the loop ,before asking this i am selecting a country and specialty and when i select only one country and one specialty it pulls the above requested textbox once and everything works fine,
          but
          when i pull more then one country and specialty then i get that text box displayed as manytimes as the selection ..suppose i selected US and Canada with Dentist then my results will be

          US                Dentist  Textbox1 (i requested)
          Canada           Dentist  Textbox2 (i requested)
          

          so i am doing some mathematical operation on these textboxes but when i run Go the end of this form then i remembers only value entered in textbox2 and give results for that in both ......

          i know i should be calling array in the form but that is what i don't know as i am new ........

          as well as i am not trying to input more then 1 value in 1 textbox but i was calling one texbox and that is taking one variable i should be calling instaed a array that can store my 2nd value in 2nd textbox

            Because all of the text boxes have the same name.

            siyaverma wrote:

            i know i should be calling array in the form but that is what i don't know as i am new ........

            Yes, you do need to have the results returned in an array; see again the link I provided. That tells you how to make several fields with the same name into an array.

              Write a Reply...