• 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
چگونگی درج مقدار combobox در جدول ؟؟؟؟
#1
درود بر عزیزلن
در mysql سه تا جدول دارم اولی مقدار combobox در آن ذخیره میشود که شامل id و code هست در جدول دوم هم شرح هر کد هست که شامل id و id_com و expl هست و یک جدول دارم که بعد از submit مقدارها در آن درج میشود و برای فرمم هم یک combobox و یک inputbox و یک دکمه submit تعبیه کردم حال در کد نویسی combobox و inputbox هیچ مشکلی ندارم بعد از انتخاب هر کد در combobox شرح آن نیز در textbox نمایش داده میشود ولی مشکلی که دارم اینه که کد و شرح در جدول سوم درج نمیگردد.
کد:
[php]
<html>
<head>
<meta charset="utf-8">






<script type="text/javascript" src="js/jquery.js"></script>


<title>

</title>
</head>
<body>

<div id="left">
   <script>
[/php]
    function showCompany(catid) {

        document.frm.submit();

    }

    
</script>

<form action="" method="post" name="frm" id="frm">

<table width="500" border="0">

  <tr>

    <td width="119">کد معین:</td>

    <td width="371">

       <select name="id_dar" id="id_dar" onChange="showCompany(this.value);">

       <option value="">--Select--</option>

       <?php
error_reporting("E_NOTICE");
        $sql1="select * from daramad";

       $sql_row1=mysql_query($sql1);

       while($sql_res1=mysql_fetch_assoc($sql_row1))

       {

       ?>

       <option value="<?php echo $sql_res1["id"]; ?>" <?php if($sql_res1["id"]==$_REQUEST["id_dar"]) { echo "Selected"; } ?>><?php echo $sql_res1["moein"]; ?></option>

        <?php

        }

        ?>

       </select>

       </td>

  </tr>

  <tr>  

    <td>شرح:</td>

    <td id="td_company">

      

       <?php
error_reporting("E_NOTICE");

       $sql="select * from sarh where id_dar='$_REQUEST[id_dar]'";

       $sql_row=mysql_query($sql);

       while($sql_res=mysql_fetch_assoc($sql_row))
          

       {

       ?>

       <input  name="sarh" value="<?php echo $sql_res["sarh"]; ?>" style="font-family:tahoma;color:black;outline: none;width:200px;direction:rtl;"    readonly >

       <?php

       }

       ?>

    </select>

       </td>

  
  </tr>
  <td>&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

</table>

</form>
<form style="text-align:center" method="post" action="" name="form1">




<span id="onvan3">:تاریخ درآمد</span><input id="inputpicker" value=" <?php $d=strtotime('yesterday');

     echo  jdate('Y/n/j',$d);

     ?> " class="input" name="AnotherDate2" type="text" placeholder="تاریخ شمسی" readonly  >



     <span id="onvan4">:مبلغ درآمد به ریال</span> <input class="inco" type="text " name="inco"   >


<input name="submit" id="btn" class="btn btn-success" type="submit" value=" ذخیره " onclick="JSalert()" style="width:100px;margin-right:270px;">

</form>
</div>


<div id="table">
<table id="employee_table" align="center">
  <thead>
   <tr id="row1">
   <tr>
<table  class="table table-striped table-bordered" style="margin-top:15px;">
                          
                            <thead>
                        
                                <tr>
                                  
                                   <th  style="display:none">ردیف</th>
                                    <th style="text-align:center">معین</th>
                                    <th style="text-align:center">شرح درآمد</th>
                                    <th style="text-align:center">مبلغ درآمد به ریال</th>
                                    <th style="text-align:center">تاریخ درآمد</th>
                        
                                 <th style="text-align:center">حذف</th>
                                
                                </tr>
                            </thead>
                            <tbody>
                            <?php
                            error_reporting("E_NOTICE");
                            $d=strtotime("yesterday");
$date=jdate("Y-n-j",$d);
                            $query=mysql_query("select id,moein,sharh,sum(inco) as total_inco,tarikh,status from jad where id_user='$login_session' and tarikh='$date' GROUP BY moein ")or die(mysql_error());
                            while($row=mysql_fetch_array($query)){
                            
                            ?>
                              
                                        <tr>
                                    <td style="display:none"><?php echo   $row['id']  ?></td>
                                         <td style="text-align:center" ><?php echo $row['moein'] ?></td>
                                         <td style="text-align:center"><?php echo $row['sharh'] ?></td>
                                         <td style="text-align:center"><?php echo  $english_format_number = number_format($row['total_inco'])."ریال" ?></td>
                                         <td style="text-align:center"><?php echo $row['tarikh'] ?></td>
                        
                            <td style="text-align:center"><?php      if( $row['status']==ok){ echo '<a class="btn btn-success"  disabled = "disabled" >ثبت</a>';}else{
                        echo '<a class="btn btn-success" href="sabt.php?id='.$row['id'].'"onclick="return sabt()">ثبت</a>';
                            }
                                   ?></td>
                            
                               <td style="text-align:center"><?php    if( $row['status']==ok){ echo '<a class="btn btn-danger"  disabled = "disabled" >حذف</a>';
                               }else{echo '<a class="btn btn-danger" href="delete.php?id='.$row['id'].'"onclick="return checkDelete()">حذف</a>';
                               }
                                   ?></td>
                                      
                                      
                                </tr>
                        
                                  <?php } ?>
                            </tbody>
                        </table>
                                <?php
                                                $d=strtotime("today");
$date=date("Y-m-d",$d);
                            $result = mysql_query("SELECT sum(inco) FROM jad where id_user='$login_session' and date='$date'") or die(mysql_error());
                            while ($rows = mysql_fetch_array($result)) {
                                ?>

                                <div class="pull-right">
                                    <div class="span"><div class="alert alert-success" style="margin-right: 250px;"><i class="icon-credit-card icon-large"></i>&nbsp;جمع در آمد روزانه:&nbsp;<?php echo $english_format_number = number_format($rows['sum(inco)'])."ریال"; ?></div></div>
                                </div>
                            <?php }
                            ?>
                            </tr>
<thead>
</table>


</div>



</body>
</html>
[/php]
  پاسخ
تشکر شده توسط :


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان