Click here to Skip to main content
15,442,473 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: DEVELOPING WEB FORM Pin
Mycroft Holmes17-Oct-18 12:43
professionalMycroft Holmes17-Oct-18 12:43 
QuestionWhy my field returns boolean instead of object? Pin
Member 1399562824-Sep-18 3:12
MemberMember 1399562824-Sep-18 3:12 
AnswerRe: Why my field returns boolean instead of object? Pin
Graham Breach24-Sep-18 3:48
MemberGraham Breach24-Sep-18 3:48 
GeneralRe: Why my field returns boolean instead of object? Pin
Member 1399562824-Sep-18 3:50
MemberMember 1399562824-Sep-18 3:50 
GeneralRe: Why my field returns boolean instead of object? Pin
Graham Breach24-Sep-18 4:57
MemberGraham Breach24-Sep-18 4:57 
AnswerRe: Why my field returns boolean instead of object? Pin
SiFinances28-Oct-18 0:52
MemberSiFinances28-Oct-18 0:52 
Questionhow to find daily cash book record from two tables with php mysql Pin
Faruk Web10-Aug-18 21:46
MemberFaruk Web10-Aug-18 21:46 
QuestionGet data attribute from an array of select box Pin
Member 85505912-Aug-18 16:23
MemberMember 85505912-Aug-18 16:23 
I have an account form in which the all account are being pulled from my mysql database into a dropdown menu. The user selects the account from the dropdown menu then the account code field is automatically populated via the data-acc attribute. I have added a button to add more account.


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div class="row">
  <div class="col-md-12">
    <div class="box box-default">
      <div class="box-header with-border">
        <h3 class="box-title">Report Per Office</h3>
      </div>
      <div class="box-body">
        <div class="col-md-12">
          <h4>Project Procurement Management Plan (PPMP) <hr >
        </div>
        <div class="col-md-1">
          Office:
        </div>
        <div class="col-md-4">
              <select class="selectpicker" data-live-search="true" name="office_from" data-width="auto" required >
              <option>--Select Reponsible Office--</option>
                          <?php 
                            $q = "SELECT * FROM `office_code_dept`";
                            $r = mysqli_query($conn,$q);
                            while($row = mysqli_fetch_assoc($r)){
                            $off_desc = $row['off_name']; 
                           ?>
                          <option value="<?php echo $off_desc;?>"><?php echo $off_desc; ?></option>
                          <?php 
                            }
                          ?>
                        </select>
                      </div>
                      <div class="col-md-1">Year:</div>
                      <div class="col-md-4"><input type="number" min="1990" max="3000" name="tax_year" class="form-control" style="text-align: center;" value="<?php echo date('Y'); ?>"></div>
                      <div class="col-md-2"><input type="submit" name="search" value="Search" class="btn btn-primary btn-block">
                      </div>
                      <div class="col-md-12"><br></div>
            </h4>

          <table class="table table-bordered" id="dynamic_field">
            <thead>
                 <tr>
                    <th width="7%" rowspan="2" style="text-align: center;">Code</th>
                    <th width="27%" rowspan="2" style="text-align: center;">General Description</th>
                    <th rowspan="2" width="5%"><button type="button" name="add" id="add" class="btn btn-success">class="fa fa-plus"></button></th>

                 </tr>

              </thead>
              <tbody>
                 <tr>
                    <td align="center">
                      <input type="text" name="account_code[]" class="form-control account_num" readonly>
                    </td>
                    <td>
                      <select class="form-control selectpicker" data-live-search="true" name="account_name[]" required>
                      <option></option>
                      <?php 
                        $account = mysqli_query($conn,"SELECT chart_of_account.acoount_no, chart_of_account.account_title from chart_of_account inner join account_group_tbl on chart_of_account.account_group = account_group_tbl.account_name where account_group_tbl.account_type = 'Expense'");
                        while($acc = mysqli_fetch_assoc($account)){
                          $account_no = $acc['acoount_no'];
                          $account_title = $acc['account_title'];
                      ?>
                      <option value="<?php echo $account_title; ?>" data-acc="<?php echo $account_no; ?>">
                        <?php echo $account_title ; ?>   
                      </option>
                    <?php } ?>
                    </select>
                    </td>
                    <td></td>
                 </tr>
              </tbody>
           </table>
      </div>   
    </div>
  </div>
</div>
<script>
   $('select[name="account_name[]').change(function()
    {
     $('.account_num').val($('select[name="account_name[]"] option:selected').data('acc'));
    });
</script>
<script>
$(document).ready(function(){
  var i=1;
  var chart_add = '<tr id="row_chart'+i+'"><td align="center">                      <input type="text" name="account_code[]" class="form-control account_num" readonly></td><td><select class="form-control selectpicker" data-live-search="true" name="account_name[]" required>                      <option></option><?php $account = mysqli_query($conn,"SELECT chart_of_account.acoount_no, chart_of_account.account_title from chart_of_account inner join account_group_tbl on chart_of_account.account_group = account_group_tbl.account_name where account_group_tbl.account_type = 'Expense'");while($acc = mysqli_fetch_assoc($account)){$account_no = $acc['acoount_no'];$account_title = $acc['account_title'];?><option value="<?php echo $account_title; ?>" data-price="<?php echo $account_no; ?>"><?php echo $account_title ; ?>                    </option><?php } ?></select></td><td><button type="button" name="remove_chart" id="'+i+'" class="btn btn-danger remove_chart"></button></td></tr>';
  $('#add').click(function(){
    i++;
    $('#dynamic_field').append(chart_add);
    $('.selectpicker').selectpicker('render');
     $('select[name="account_name[]').change(function()
       {
          $('.account_num').val($('select[name="account_name[]"] option:selected').data('acc'));
        });
    });
  $(document).on('click', '.remove_chart', function(){
    var button_id = $(this).attr("id"); 
    $('#row_chart'+button_id+'').remove();
  });
  
});
</script>

QuestionHow to allow access to a yii web application for specific users using .htaccess Pin
Member 139352711-Aug-18 23:20
MemberMember 139352711-Aug-18 23:20 
AnswerRe: How to allow access to a yii web application for specific users using .htaccess Pin
Richard MacCutchan2-Aug-18 0:40
mveRichard MacCutchan2-Aug-18 0:40 
AnswerRe: How to allow access to a yii web application for specific users using .htaccess Pin
Richard MacCutchan2-Aug-18 1:31
mveRichard MacCutchan2-Aug-18 1:31 
GeneralRe: How to allow access to a yii web application for specific users using .htaccess Pin
Member 139352712-Aug-18 1:35
MemberMember 139352712-Aug-18 1:35 
GeneralRe: How to allow access to a yii web application for specific users using .htaccess Pin
Richard MacCutchan2-Aug-18 3:49
mveRichard MacCutchan2-Aug-18 3:49 
GeneralRe: How to allow access to a yii web application for specific users using .htaccess Pin
Member 1393527114-Aug-18 1:02
MemberMember 1393527114-Aug-18 1:02 
GeneralRe: How to allow access to a yii web application for specific users using .htaccess Pin
Member 1393527114-Aug-18 1:02
MemberMember 1393527114-Aug-18 1:02 
QuestionHow Can I Start Learning PHP Pin
Andre Hoss3-Jul-18 7:03
MemberAndre Hoss3-Jul-18 7:03 
AnswerRe: How Can I Start Learning PHP Pin
Richard MacCutchan3-Jul-18 8:27
mveRichard MacCutchan3-Jul-18 8:27 
AnswerRe: How Can I Start Learning PHP Pin
Member 1501179923-Dec-20 7:29
MemberMember 1501179923-Dec-20 7:29 
Questionphp-mysql Pin
Raja Jee2-Jul-18 18:38
MemberRaja Jee2-Jul-18 18:38 
AnswerRe: php-mysql Pin
Richard MacCutchan2-Jul-18 21:09
mveRichard MacCutchan2-Jul-18 21:09 
Questiontrying to get ipn simulator to work.... Pin
piano001126-Jun-18 1:35
Memberpiano001126-Jun-18 1:35 
AnswerRe: trying to get ipn simulator to work.... Pin
Richard MacCutchan26-Jun-18 2:07
mveRichard MacCutchan26-Jun-18 2:07 
QuestionHow to run .html file as default then will run .php of wordpress in same folder by using .htaccess Pin
Member 1388249624-Jun-18 23:32
MemberMember 1388249624-Jun-18 23:32 
Rant[REPOST] How to run .html file as default then will run .php of wordpress in same folder by using .htaccess Pin
Richard Deeming25-Jun-18 7:32
mveRichard Deeming25-Jun-18 7:32 
QuestionHow can I set the timestamp to 0? Pin
piano001114-Jun-18 2:38
Memberpiano001114-Jun-18 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.