sugan Posted January 7, 2008 Share Posted January 7, 2008 I am having an array of values.If i store the values in another array the following error occurs. Warning: Cannot use a scalar value as an array in e:\edo\customer\addtrans1.php on line 232 The code is: $quantity[$i]=$_POST['quantity'.$i]; $qq[$i]=$quantity[$i]; echo $qq[$i]; If i delete the line $qq[$i] then it works fine.what is the error over here.Pls help! Link to comment Share on other sites More sharing options...
Ingolme Posted January 7, 2008 Share Posted January 7, 2008 I don't see anything incorrect there, but I think that can be simplified anyways, why not do it like this?$qq[$i]=$_POST['quantity'.$i];echo $qq[$i]; Link to comment Share on other sites More sharing options...
jhecht Posted January 7, 2008 Share Posted January 7, 2008 Did you define $qq as an array earlier in your script? Link to comment Share on other sites More sharing options...
aspnetguy Posted January 7, 2008 Share Posted January 7, 2008 That error occurs when you try to use a variable as an array but it wasn't declared as an array.You need to declare $qq as an array first. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.