• 05-05-2018, 22:31:11
    #1
    Merhaba arkadaşlar,

    for ($i=0; $i <count($result); $i++) {
    
                                                    $id = $result[$i]['id'];    
                                                    $service_id = $result[$i]['service_id'];
                                                    $quantity = $result[$i]['quantity'];
                                                    $price = $result[$i]['price'];
                                                    $date = $result[$i]['date0'];
                                                    $user = $result[$i]['user_link'];
                                                    $start_count = $result[$i]['start_count'];
                                                    $remains = $result[$i]['remains'];
                                                    $status = $result[$i]['status'];
    
                                                    $sth = $baglanti->prepare("SELECT * FROM service where id = $service_id");
                                                    $sth->execute();
                                                    $result2 = $sth->fetchAll(PDO::FETCH_ASSOC);
                                                    $service_name = $result2[0]['service_name'];
    
    
    
                                                    echo '
                                                        <form method="post" action="orders-manuel.php?id='.$id.'">
                                                            <tr>
                                                                <th scope="row">'.$id.'</th>
                                                                <td>'.$service_name.'</td>
                                                                <td>'.$quantity.'</td>
                                                                <td>'.$user.'</td>
                                                                <td><input style="padding-left:7px; width:70%; " name="start_count" value="'.$start_count.'"></td>
                                                                <td><input style="padding-left:7px; width:70%;" name="remains" value="'.$remains.'"></td>
                                                                <td>
                                                                <select name="status" style="padding-left:45px;" >
                                                                <option value="Pending" > Beklemede </option>
                                                                <option value="Partial" > Kısmi Tamamlandı </option>
                                                                <option value="Completed" > Tamamlandı </option>
                                                                <option value="Canceled" > İptal Edildi </option>
                                                                </td>
                                                                <td>'.$date.'</td>
                                                                <td><button class="btn btn-default2"> Güncelle </button></td>
                                                            </tr>
                                                        </form>
                                                    ';
                                                }
    Select optionlarda üstten gelen status değişkeninin içeriği ne ise onun seçili olmasını istiyorum.

    if ($status== "Pending" ) echo "selected"tarzı yapıyorum ama çalışmıyor
  • 05-05-2018, 22:48:26
    #2
    <option value="Pending" '.if($status=="Pending"{echo "selected"}.' > Beklemede </option>
    satırı bu şekilde değiştirir misin