why does this echo just the value 1 and not 7?


Page1
    <td class="BG_<?php echo $s; ?>"><input name="T_<?php echo $DPI; ?>" type="radio" value="7" <?php if ($C == 7) { echo "checked"; } ?>/></td>




Page2
echo " --  " . isset($_POST["T_$DPI"]) . "<Br>";

    No obvious reason, so I'd check program logic. Perhaps some other form element carries the same name?

    <form action="" method="post">
    	7-radio <input type="radio" value="7" name="rd" />
    	<br/>
    	1-text (replaces above one) <input type="text" value="1" name="rd" />
    	<br/>
    
    <input type="submit" />
    </form>
    
    <div>
    <?php
    if (isset($_POST['rd']))
    	echo $_POST['rd'];
    ?>
    

    Or perhaps you are referencing the wrong element because $DPI isn't the same for both pages?

    What does $_POST look like when using print_r?
    What does the actually produced html code look like?
    What's $DPI on the second page?

      The issue is i can't pass in a variable to my POST

      So when i I do $POST['T_33'] it works for but when i do $POST['T_$DPI'] is fails even if $DPI has the value of 33

      How can i get around this, i've thought of

      $Val = "T" .$DPI;
      echo " -- " . isset($
      POST[ . "'$Val'" . ]) . "<Br>";

      but get a pharse error.

      and even

      echo " -- " . isset($POST[ "'T$DPI"]) . "<Br>";

      but i get nothing.

      Arrr

        and now

        		$Val = "T_" .$DPI; 
        
        
        	echo " -- " . isset($_POST[' . "$Val" . ']) . "<Br>";
        

        But nothing echo's

          take the isset away and it works, however the rows where there is no value has this

          Notice: Undefined index: T_7541 in E:\wamp\www\admin\process.php on line 1

          How can i get around that?

            Write a Reply...