Jump to content

albmed7589

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by albmed7589

  1. Hey guys I need some help, 

    Im trying the make a page that will list the selected customer's name with a drop down bow that will show ( and let the user change ) the customer's status

     

    this is what I've got so far
     

    <?php
    include("_credentials.php");
    include("_mysql.php");
    include("_login.php");
    $is_AddingToOffice = $_POST["AddToOffice"];
    ?>
     
    <html>
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
     
            <link rel="stylesheet" href="css/common.css" />
            <link rel="stylesheet" href="css/grid.css" />
     
            <script src="ckeditor/ckeditor.js"></script>
            <script src="js/jquery.min.js"></script>
            <script src="js/moment.js"></script>
        </head>
        <body>
        <?php include("common_header.php"); ?>
     
        <div class="container">
            <div class="page page_margin box">
                <h1>
                    <b><?=$is_AddingToOffice ? 'Add Customers to Office' : 'Edit Customers Status'?></b>
                </h1>
     
                <?php if ($is_AddingToOffice): ?>
                <form method="POST" action="actions/edit_task.php">
                <input type="hidden" name="cid" value="<?=$cid?>" />
                <div class="grid">
     
     
     
     
    <?php
    //this set of code will handle the bulk user status settings.
    if (isset($_POST["AddToOffice"])):
     
    $ids = $_POST['check_list'];
    foreach ($_POST['check_list'] as $checks)
      {
     
            $query = "SELECT `id`,`name`,`status` FROM `customers` WHERE `id`=?";
            $stmt = $db->prepare($query);
            $stmt->bind_param("i", $checks);
            $stmt->execute();
            $stmt->bind_result($cid, $name, $status);
            while($stmt->fetch())
              { ?>
     
                <div class="form_row grid__col grid__col--2-of-2">
                    <div class="label"><?=$name?></div>
                </div>
     
     
     
            <?php  }
     
      }
      endif
     
    ?>
     
    <div class="form_row grid__col grid__col--1-of-2">
        <input type="submit" value="Submit Edit" class="button button-primary" />
    </div>
    </div>
    </form>
    <?php endif ?>
     
     
     
     
     
     
                  <?php if (!$is_AddingToOffice): ?>
                  <div class="form_row grid__col grid__col--1-of-3">
                  <form method="GET" action="view_task.php">
                         <input type="hidden" name="cid" value="<?=$cid?>" />
                         <input type="hidden" name="edit" value="1" />
                         <input type="submit" value="Edit Task" class="button button-primary" />
                 </form>
               </div>
                  <div class="form_row grid__col grid__col--1-of-3">
                   <form method="POST" action="actions/mark_complete.php">
                         <input type="hidden" name="task_id" value="<?=$task_id?>" />
                         <input type="submit" value="Mark as Complete" class="button button-error" />
                   </form>
                       </div>
     
                 <?php else: ?>
                 <?php endif ?>
                </div>
            </div>
     
            <script>
            <script src="js/common.js"></script>
        </body>
    </html>
    
    

    and I need to add somthing like this to the while statement

     

                <div class="form_row grid__col grid__col--2-of-3">
                  <div class="label">Status</div>
                  <select type="text" name="status" class="form_element">
                      <option value="NULL"></option>
                <?php
                      $stmt = $db->prepare("SELECT * FROM `statuses`");
                      $stmt->execute();
                      $stmt->bind_result($id, $statuses);
     
                      while($stmt->fetch())
                      {
                          ?>
                          <option value="<?=$id?>"><?=htmlspecialchars($statuses)?></option>
                          <?php
                      }
                      ?>
                  </select>
              </div>
    
  2. This is my code

    $stmt = $db->prepare("SELECT factory FROM offices
        WHERE id=?");
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $stmt->bind_result($factory);
     
    echo "<br />factory: ".$factory;
    
    

    problem is there is no value being assigned to the $factory variable. when I run the query in PHPMyAdmin I get back one result, as expected. Any help would be highly appreciated 

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.