I have this piece of code in my page:
$options = array("Repairing", "In guarantee", "Ended", "On Hold", "Waiting for quote");
?>
<select name='estadoRep[]' id='estadoRep'>
<?php foreach ($options as $option): ?>
<option value="<?php echo $option; ?>"<?php if ($estadoR[$i] == $option): ?> selected="selected" <?php endif; ?>>
<?php echo $option; ?>
</option>
<?php endforeach; ?>
This code will send the status of equipment through a form to another page.
When I "receive" those value through the POST method on the other page, I have the need to fill up a variable if all status in the array = "Ended". If all array[%i] = "Ended" the variable $status should be filled with: "Concluded" else if only one as different value the variable should be filled with "Pending";
I tried the following code but it is not working. Can you please give me some advice? Thanks
$estadoEquip = $_POST['estadoRep'];
$max = sizeof($estadoEquip);
for ($i=0; $i<$max; $i++) {
if ($estadoEquip[$i] = 'Ended')
$status= 'Concluded';
if ($estadoEquip[$i] != 'Ended')
$status= 'Pending';
}}