Jump to content

Stuck on retreiving values on next page


alanl1
Go to solution Solved by DavidAM,

Recommended Posts

Hi all

 

 

I have the following code block and on my second page I can pull the values with the second for loop

 
foreach ($_POST[$data] as $datanumcolumns=>$datadownboxValue){

 echo "Dropdown array value" .$datanumcolumns. " columns dropdown value " .$datadownboxValue. " "?><br /><br /><?php

}
 
foreach ($_POST['dropdown'] as $dropnumcolumns=>$dropdownboxValue){

 echo "Dropdown array value" .$dropnumcolumns. " columns dropdown value " .$dropdownboxValue. " "?><br /><br /><?php

}
 
 

trouble is the dropdown box values are showing no problem but the textbox ones are not. could it be that $data variable or something.

here is the part of my initial page code block

 <?php

    // Two counter variables necessary for looping purposes for dynmaic drop down box javascript client side functions

$counter = 1;

$counter1 = 1;


    if (($handle = fopen($filename, "r")) !== FALSE)    

 {        

 $length = 1000;        

 $delimiter = ",";     
 $rows = 0;  // ADDED        

 while ( ( $data = fgetcsv( $handle, $length, $delimiter ) ) !== FALSE )        

 {        

 if( $rows == 0 )       

 {                

   $num = count($data);

   for ($c=0; $c < $num; $c++)                

    { 

   echo "<table width=100% border=0>";

    echo "<tr width=25% align=right><td>";
    for ($d=0; $d < $num; $d++)                

    {  

     //echo "<option value='" .$data[$d]."'>" .$data[$d]."</option>";

   }

   echo "<input type='text' id='".$data[$c]."' value='".$data[$c]."' DISABLED='disabled' style='background-color:White; color:Black;'>";

    echo "</td>";

      echo "<td width=20% align=left>";

      ?> <---- Matches to -----> <select name="<?php echo "dropdown[" .$c."]" ?>" id="<?php echo "dropdown[" .$c."]" ?>" class="nohide" onchange="fillSelect(this,categories[this.value],'<?php echo "dropdown" .$counter++ ?>')"><?php

      echo "<option selected>Please Choose</option>";

      echo "<option value='Manufacturer" .$c. "'>Software Manufacturer</option>";

      echo "<option value='Product" .$c. "'>Product Name</option>";

      echo "<option value='Version" .$c. "'>Product Version</option>";

      echo "<option value='Keep Existing" .$c. "'>Keep Existing</option>";

      echo "<option value='Ignore" .$c. "'>Ignore</option>";   

      ?></select><?php

      echo "</td>";

     echo "<td width=15% align=left>";

     ?> <select name="<?php echo "secondDD[" .$c ."]" ?>" id="<?php echo "secondDD[" .$c."]" ?>" style="display:none;" onchange="fillSelect(this,categories[this.value],'<?php echo "secondDD[" .$counter1++ ."]" ?>')"><?php

      echo "<option selected>Please Choose</option>";

      echo "<option value='Manufacturer2" .$c. "'>Software Manufacturer</option>";

      echo "<option value='Product2" .$c. "'>Product Name</option>";

      echo "<option value='Version2" .$c. "'>Product Version</option>";

      echo "<option value='Keep Existing2" .$c. "'>Keep Existing</option>";

      echo "<option value='Ignore2" .$c. "'>Ignore</option>";   

      ?></select><?php

      echo "</td>";

    echo "</tr>";

    echo "</table>"; 

    }                                 

 }       

 $rows++; // ADDED      

 }              

  fclose($handle);    

 }
Link to comment
Share on other sites

Update FYI

 

 

I have managed to do this, I changed to a readonly textbox

 

<input type="text" name="<?php echo "textbox[" .$c ."]" ?>" id="<?php echo "textbox[" .$data[$c]."]" ?>" value="<?php echo $data[$c] ?>" readonly="readonly" style="background-color:White; color:Black;">
then
foreach ($_POST['textbox'] as $datanumcolumns=>$datadownboxValue){
 echo "Textbox value" .$datanumcolumns. " has a value of " .$datadownboxValue. " "?><br /><?php
}
Link to comment
Share on other sites

  • Solution

apparently it is not possible when the text box is set to disabled so i have set this to read only.

 

does anyone know if it is possible now

 

 

thanks in advance

This is a true statement. Disabled form elements are not posted with the form. Read Only elements are posted.

 

Keep in mind, however, that it is very simple for a visitor to change the value if they try -- the same is true for hidden elements which are posted.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.