More Php Coding help

I have all this code and I need added a somthing to the drop down box uner all vendor prices. I need it to say No Winner, it already says the company name with a bid. I just need no winner as an option to select . any help would be greatly thanked.

Quantity Unit(s) Description All Vendor Prices
                        <!--/*for($colIterator=0; $colIterator<$vendorResponseCounter; $colIterator++){
                        //echo "<th scope=\"col\">$vendorName[$colIterator]</th>";
                        }*/
                        //echo "<th scope=\"col\">Lowest for this item</th>";-->
                        <?php
                        // loop to create table with bid items and qtys
                        for($i=0; $i<$counterArrayBidItems; $i++){
                            echo "<tr>";
                            echo "<td>$arrayBidQtys[$i]</td>";
                            echo "<td>$arrayBidItems[$i]</td>";
                            echo "<td>$arrayBidDescr[$i]</td>";
                            ?>
                            <td>
                            <select name="no winner[]">
                            <select name="bidwinner[]">
                            <?php
                            
                            // nested for loop to load the cherry picker lowest price for a row
                            for($cpIterator=0; $cpIterator<$vendorResponseCounter; $cpIterator++){
                                
                                $cpArrayLowestPrice[$cpIterator] = $mainArrayVendorPrices[$cpIterator][$i];
                            }
                            
                            // nested for loop to output undetermined number of cells in the table row
                            for($rowIterator=0; $rowIterator<$vendorResponseCounter; $rowIterator++){
                                if($mainArrayVendorPrices[$rowIterator][$i] != "0" && $mainArrayVendorPrices[$rowIterator][$i] != null && $mainArrayVendorPrices[$rowIterator][$i] != '')
                                {
                                    $dsc = $mainArrayVendorPrices[$rowIterator][$i];
                                    $ttlaz = floatval($dsc);// * $arrayBidQtys[$i];
                                    if($dsc > 0)
                                    {
                                        $dsc = '$'  . number_format($ttlaz,2);
                                    }
                                    else
                                    {
                                        $dsc = '';
                                    }
                                    echo '<option value="' . $vendorid[$rowIterator] .'">'.$vendorName[$rowIterator]. ' - ' . $dsc .'</option>';
                                }
                            }
                            ?>
                            </select>
                            </td>

Well, you have a “FOR” that loops thru your values for the drop-down.
Each option is created using this line:
echo ‘’.$vendorName[$rowIterator]. ’ - ’ . $dsc .’’;
You can add an additional “option” manually. The value of the option would be a number that is unique to the rest of the values created from the $vendorid’s. Usually this would be either 0 (zero) or a much higher number that you will never reach in the total $vendorid’s, like 999999. Or, it could even just be a text value, since the rest of your code could check for that, like “No_Winner”.

You could just add this line:
echo ‘No Winner’;
You would place this OUTSIDE of your “FOR” loop, but, still inside of your SELECT clauses.

In the code that accepts this form, you would have to alter your check for the value of this drop-down to allow for handling the new option.

Hope that makes sense. Hope it helps. Let us know if you get it working or if you need further help with it.

Good luck!

So the code would look like this ?? I hope

[php]

Quantity Unit(s) Description All Vendor Prices
                        <!--/*for($colIterator=0; $colIterator<$vendorResponseCounter; $colIterator++){
                        //echo "<th scope=\"col\">$vendorName[$colIterator]</th>";
                        }*/
                        //echo "<th scope=\"col\">Lowest for this item</th>";-->
                        <?php
                        // loop to create table with bid items and qtys
                        for($i=0; $i<$counterArrayBidItems; $i++){
                            echo "<tr>";
                            echo "<td>$arrayBidQtys[$i]</td>";
                            echo "<td>$arrayBidItems[$i]</td>";
                            echo "<td>$arrayBidDescr[$i]</td>";
                            ?>
                            <td>
                            <select name="no winner[]">
                             
                            <select name="bidwinner[]">
                             echo '<option value="No_Winner">No Winner</option>';
                            <?php
                           
                            // nested for loop to load the cherry picker lowest price for a row
                            for($cpIterator=0; $cpIterator<$vendorResponseCounter; $cpIterator++){
                               
                                $cpArrayLowestPrice[$cpIterator] = $mainArrayVendorPrices[$cpIterator][$i];
                            }
                           
                            // nested for loop to output undetermined number of cells in the table row
                            for($rowIterator=0; $rowIterator<$vendorResponseCounter; $rowIterator++){
                                if($mainArrayVendorPrices[$rowIterator][$i] != "0" && $mainArrayVendorPrices[$rowIterator][$i] != null && $mainArrayVendorPrices[$rowIterator][$i] != '')
                                {
                                    $dsc = $mainArrayVendorPrices[$rowIterator][$i];
                                    $ttlaz = floatval($dsc);// * $arrayBidQtys[$i];
                                    if($dsc > 0)
                                    {
                                        $dsc = '$'  . number_format($ttlaz,2);
                                    }
                                    else
                                    {
                                        $dsc = '';
                                    }
                                    echo '<option value="' . $vendorid[$rowIterator] .'">'.$vendorName[$rowIterator]. ' - ' . $dsc .'</option>';  
                                }
                            }
                            ?>
                            </select>
                            </td>                                                    [/php]

Not exactly…

This is the format for a tag:

Option#1 name used for display Option#2 name

For some reason, in your code you have nested two or more tags. You can not do that.
In the example above the tags should be inside the clause.
This is loaded in your code thru a “FOR” command where the options are loaded from an array.
AFTER the array, you can add more tags and load whatever you wish. As in my example,
you could add the “No_Winner” value as the last option tag. Or, you could place it BEFORE the “FOR”
and it would become the first option in the list.

In your code, you have two nested tags, one for “no winner” and one for “bidwinner”. This is incorrect. Perhaps you meant them to be options?

Try again. Hope this helps…

I see now yea that was a mistake lol

It will look like this

Quantity Unit(s) Description All Vendor Prices
                        <!--/*for($colIterator=0; $colIterator<$vendorResponseCounter; $colIterator++){
                        //echo "<th scope=\"col\">$vendorName[$colIterator]</th>";
                        }*/
                        //echo "<th scope=\"col\">Lowest for this item</th>";-->
                        <?php
                        // loop to create table with bid items and qtys
                        for($i=0; $i<$counterArrayBidItems; $i++){
                            echo "<tr>";
                            echo "<td>$arrayBidQtys[$i]</td>";
                            echo "<td>$arrayBidItems[$i]</td>";
                            echo "<td>$arrayBidDescr[$i]</td>";
                            ?>
                            <td>
                            
                             
                            <select name="bidwinner[]">
                             echo '<option value="No_Winner">No Winner</option>';
                            <?php
                           
                            // nested for loop to load the cherry picker lowest price for a row
                            for($cpIterator=0; $cpIterator<$vendorResponseCounter; $cpIterator++){
                               
                                $cpArrayLowestPrice[$cpIterator] = $mainArrayVendorPrices[$cpIterator][$i];
                            }
                           
                            // nested for loop to output undetermined number of cells in the table row
                            for($rowIterator=0; $rowIterator<$vendorResponseCounter; $rowIterator++){
                                if($mainArrayVendorPrices[$rowIterator][$i] != "0" && $mainArrayVendorPrices[$rowIterator][$i] != null && $mainArrayVendorPrices[$rowIterator][$i] != '')
                                {
                                    $dsc = $mainArrayVendorPrices[$rowIterator][$i];
                                    $ttlaz = floatval($dsc);// * $arrayBidQtys[$i];
                                    if($dsc > 0)
                                    {
                                        $dsc = '$'  . number_format($ttlaz,2);
                                    }
                                    else
                                    {
                                        $dsc = '';
                                    }
                                    echo '<option value="' . $vendorid[$rowIterator] .'">'.$vendorName[$rowIterator]. ' - ' . $dsc .'</option>';  
                                }
                            }
                            ?>
                            </select>
                            </td>

Yes, I think that should do it.

Now, do not forget, that on the page that uses this drop-down, you will have to have it check for the no-winner option and handle it however you want to. What I mean is that this displayed page is used somewhere, wherever the posted values are handled. In that code, you will have to check for the no winner option and handle it somehow.

Well, looks like you have that part figured out. Do you want me to mark this topic solved? Or was there more to your question?

Mark it done . that is all i needed with this topic . thanks you rock

Great! Glad I could help!

Sponsor our Newsletter | Privacy Policy | Terms of Service