1

I've the following code :

$query = "SELECT * FROM items WHERE SUBSTRING(item_no, 1, ".$length.") BETWEEN 
'".$from_new."' AND '".$to_new."' ORDER BY item_no Desc";
$result = mysql_query($query);

$dd=array();
$ii=array();
$qq=array();
$aa=array();

if(mysql_num_rows($result)>0){
$num = mysql_num_rows($result);
?>

<form method="post" action="final_group_items.php">

<?php
echo "<table>";
for($i=0;$i<$num;$i++){
$row = mysql_fetch_array($result);
echo "<tr><td align=center>"; ?>

<input disabled  maxlength="2" type="text"
name="ii[]" value="<?php echo strtoupper($row['item_no']); ?>"><?php echo 
"</td><td align=center>";?> 

<input disabled maxlength="2" type="text" 
name="qq[]" value="<?php echo $row['qty'];?>"> 

<?php echo "</td><td align=center>"; ?> 

<input disabled maxlength="2" type="text" 
name="aa[]" value="<?php echo $row['actual_price'];?>"> 

<?php echo "</td><td align=center>";?>

<input required maxlength="2" type="text" name="dd[]" value="<?php echo 
$row['discount_price']; ?>">
<?php
echo "</td><tr>";
}   
echo "</table>";
?>

<input type="submit" value="Change Values">
</form>

Now when i click Submit it will open the final_group_items.php which has the follow testing code to make sure if all array (ii,qq,dd,aa) are not empty:

if(empty($_POST['qq']))
   {
     echo "No value inside";
     return false;

   }
   foreach($_POST['qq'] as $test)
   {
     echo $test;
   }
   return true;

so by testing all array's, the only one works is $_POST['dd']...Others outputs "no value inside" which I really don't know how or why? What should I do when I have multiple of fields having uniqe arrays and values.

Thank You

5
  • Because there's a disabled in the input tag of the others? Commented Oct 1, 2012 at 17:38
  • @Jack I've tried to remove disabled, same result ! Commented Oct 1, 2012 at 17:39
  • you jump in/out of php mode way too much. a lot of those echoes don't need to be done from inside php mode... Commented Oct 1, 2012 at 17:44
  • @MarcB I'm sorry, but i'm not an php expert. If you could provide me with website tutorial on enhancing my issue i'd appreciate it ! Commented Oct 1, 2012 at 17:48
  • your echo "<table>" is redundant.. just have <table> OUTSIDE of the php tag. it's not in a loop, it's not a dynamic string, so why waste cpu cycles in php mode to output it? Commented Oct 1, 2012 at 18:06

1 Answer 1

1

This:

<input disabled maxlength="2" type="text" name="qq[]" value="<?php echo $row['qty'];?>">  

Will prevent the browser from even posting the field at form submission, because disabled gets an implicit value of "disabled".

The attribute should be removed:

<input maxlength="2" type="text" name="qq[]" value="<?php echo $row['qty'];?>">  
3
  • You mean for disabled ? I've removed disabled and tested it .. Same result. Commented Oct 1, 2012 at 17:41
  • @Alihamra Did you hard refresh the page? Commented Oct 1, 2012 at 17:42
  • You are right, i've tested it on different browser and it worked ! Thank you so much. Commented Oct 1, 2012 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.