Forum Moderators: coopster
Yes, very existential, I know LOL
I'll start with the code:
for($n=1;$n<=$attcount;$n++){
$attnames = 'attribute' . $n . '_value';
$attributes = get_post_meta($post->ID, $attnames, true);
$getall = explode("\r\n",$attributes);
$count = count($getall);
this works exactly as it needs to. $count properly pulls in the exact values I need.
My issue is this:
I need $count*$count - which I can't do just with that type of call because it'll just blow up in my face.
Basically, the values in the above piece of code are very dynamic. I use one form to set how many fields I need in a another form. So if - in the initial form - someone enters "3", then in the next form there are 3 input fields.
In each input field, you can have as many values as you like, separated by line breaks. So I need to count the values in each input field.
If there is only *one* input field, I just need $count. That's working fine - no problems at all.
However, if there's 2 or more input fields, I need the count for *each* field, and then I need to multiply the $count for *each* field by the other fields. So if there's 3 fields, and one field has 3 values, another has 6, and the last has 1, then I need something that is similar to:
$total = ($count1 * $count2 * $count3);
My issue is I can't seem to get form point a to point b. I'm looking for some piece of code that goes between "$count = count($getall);" and "$total = ($count1 * $count2 * $count3);".
Anyonehave ideas for me?