Codeigniter:在LocalHost中编辑代码工作文件,但在服务器站点上没有正常工作

时间:2017-09-23 08:05:03

标签: php jquery codeigniter

我被困在这里。我正在一个网站上工作,我需要通过管理面板编辑个人资料,但当我尝试编辑信息时,我遇到了问题。我简介它有一些个人信息,如姓名手机号码,然后地址信息,您需要分别根据所选国家选择国家和城市。但是当我保存信息时,国家部分从数据库中删除意味着我在名称或手机号码部分中所做的更改,但是在国家/地区部分区域,它们没有显示并被删除,因此我必须通过表格手动添加它们。我希望你明白我的观点,这是代码

view.php

function checkProvince() {
    $("#loaderIcon").show();
    jQuery.ajax({
    url: "<?php echo base_url();?>check_province.php",
    //data:'cnic='+$("#cnic").val(),
    data:'state='+$("#state").val(),
    type: "POST",
    success:function(data){
        $("#user-availability-status9").html(data);
        document.getElementById("hidden9").value = data;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
}
function checkContinent() {
    $("#loaderIcon").show();
    jQuery.ajax({
    url: "<?php echo base_url();?>check_continent.php",
    //data:'cnic='+$("#cnic").val(),
    data:'continent='+$("#continent").val(),
    type: "POST",
    success:function(data){
        $("#user-availability-status39").html(data);
        document.getElementById("hidden39").value = data;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
}
</script>
<body>
<script>
<script>
window.onload=function() {

  document.getElementById("countrydropdown").onchange=function() {
    //var period = this.value;
    var e = document.getElementById("select");
    var strUser = e.options[e.selectedIndex].value;
    document.getElementById("hidden20").value = strUser;

    //var e = document.getElementById("select");
    var ctry = e.options[e.selectedIndex].text;
    document.getElementById("hiddencountry").value = ctry;
    //alert(strUser);
    //if (districtid=="") return; // please select - possibly you want something else here
    //alert(period);
    jQuery.ajax({
        url: "<?php echo base_url();?>province_state.php",
        data: { country_code : strUser},
        type: "POST",
        success:function(data){
        $("#provincedropdown").html(data);
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
  }

function checkstate() {
    $("#loaderIcon").show();
    jQuery.ajax({
    url: "<?php echo base_url();?>check_state.php",
    //data:'cnic='+$("#cnic").val(),
    data:'state='+$("#state").val(),
    type: "POST",
    success:function(data){
        $("#user-availability-status111").html(data);
        document.getElementById("hiddenstate").value = data;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
}

function checkCity() {
    $("#loaderIcon").show();
    jQuery.ajax({
    url: "<?php echo base_url();?>check_city.php",
    //data:'cnic='+$("#cnic").val(),
    data:'city='+$("#city").val(),
    type: "POST",
    success:function(data){
        $("#city-availability").html(data);
        document.getElementById("hiddencity").value = data;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
}

function checkProvince() {
    $("#loaderIcon").show();
    jQuery.ajax({
    url: "<?php echo base_url();?>check_province.php",
    //data:'cnic='+$("#cnic").val(),
    data:'state='+$("#state").val(),
    type: "POST",
    success:function(data){
        $("#user-availability-status9").html(data);
        document.getElementById("hidden9").value = data;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
}
function checkContinent() {
    $("#loaderIcon").show();
    jQuery.ajax({
    url: "<?php echo base_url();?>check_continent.php",
    //data:'cnic='+$("#cnic").val(),
    data:'continent='+$("#continent").val(),
    type: "POST",
    success:function(data){
        $("#user-availability-status39").html(data);
        document.getElementById("hidden39").value = data;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
}
</script>

<script>
window.onload=function() {

  document.getElementById("countrydropdown").onchange=function() {
    //var period = this.value;
    var e = document.getElementById("select");
    var strUser = e.options[e.selectedIndex].value;
    document.getElementById("hidden20").value = strUser;

    //var e = document.getElementById("select");
    var ctry = e.options[e.selectedIndex].text;
    document.getElementById("hiddencountry").value = ctry;
    //alert(strUser);
    //if (districtid=="") return; // please select - possibly you want something else here
    //alert(period);
    jQuery.ajax({
        url: "<?php echo base_url();?>province_state.php",
        data: { country_code : strUser},
        type: "POST",
        success:function(data){
        $("#provincedropdown").html(data);
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
  }

     document.getElementById("provincedropdown").onchange=function() {
    //var period = this.value;
    var e = document.getElementById("selectprovince");
    var strUser = e.options[e.selectedIndex].value;
    document.getElementById("hidden20").value = strUser;

    var ctry = e.options[e.selectedIndex].text;
    document.getElementById("hiddenstate").value = ctry;

    var rate_value;
    if (document.getElementById('male').checked) {
    rate_value = document.getElementById('male').value;
    }
    else{
        rate_value = document.getElementById('female').value;
    }
    document.getElementById("hidden25").value = rate_value;

    var e1 = document.getElementById("select");
    var strUser1 = e1.options[e1.selectedIndex].value;
    //alert(strUser);
    //if (districtid=="") return; // please select - possibly you want something else here
    //alert(period);
    jQuery.ajax({
        url: "<?php echo base_url();?>city.php",
        data: { country : strUser1 , city : strUser },
        type: "POST",
        success:function(data){
        $("#citydropdown").html(data);
        //document.getElementById("hiddencity").value = strUser;
        $("#loaderIcon").hide();

    },
    error:function (){}
    });
  }
}
</script>



 <label class="control-label" for="email">Country</label> *<br>
    <span id="countrydropdown"></span>
    <?php
    $selected='';
    $con=mysqli_connect("localhost","","","freedomorg");
      $sql=mysqli_query($con,"SELECT id,name FROM countries");
        if(mysqli_num_rows($sql)){
        $select= '<select name="select" id="select">';
while($rs=mysqli_fetch_array($sql))
{
      if($rs['name']===$country)
      {
        $select.='<option selected="selected" value="'.$rs['id'].'">'.$rs['name'].'</option>';
      }
      else
      {
      $select.='<option value="'.$rs['id'].'">'.$rs['name'].'</option>';
      }

  }
  $select.='</select>';
echo $select;
}
//P}OaK[oW@s[U

?>
    </div>
    <input type="hidden" id="hidden20" name="hidden20" value="">
    <input type="hidden" id="hiddencountry" name="hiddencountry" value="">
    <div class="control col-md-5">

    <label class="control-label" for="email">Continent</label> *<br>
    <select id="selectcontinent">
      <option value="Asia">Asia</option>
      <option value="Africa">Africa</option>
      <option value="North America">North America</option>
      <option value="South America">South America</option>
      <option value="Antarctica">Antarctica</option>
      <option value="Europe">Europe</option>
      <option value="Australia">Australia</option>
    </select>
    </div>

    <input type="hidden" id="hidden32" name="hidden32" value="">


        <div class="control col-md-5">
      <label class="control-label"  for="username">State/Province *</label><br>
       <span id="provincedropdown"></span>
         <?php
//       $country_code = $_POST["country_code"];
    $con=mysqli_connect("localhost","","","freedomorg");
    $sql1=mysqli_query($con,"SELECT code FROM countries WHERE name='$country'");
    $row = mysqli_fetch_assoc($sql1);
    $result=$row['code'];
 $sql=mysqli_query($con,"SELECT code,name FROM regions WHERE country='$result' order by name ASC");
if(mysqli_num_rows($sql)){
$select= '<select name="select" id="selectprovince">';

while($rs=mysqli_fetch_array($sql)){
    if($rs['name']===$province)
    {
      $select.='<option selected="selected" value="'.$rs['code'].'">'.$rs['name'].'</option>';
  }
  else
  {
    $select.='<option value="'.$rs['code'].'">'.$rs['name'].'</option>';    
  }
  }
  $select.='</select>';
echo $select;
}


?>
     <!--  <input type="text" id="state" name="state" placeholder="" class="input-xlarge" onBlur="checkstate()"><span id="user-availability-status111"></span><!--onBlur="OverseasValidation()"><span id="user-availability-status11"></span>-->
    </div>
    <input type="hidden" id="hiddenprovince" name="hiddenprovince" value="">
    <input type="hidden" id="hiddenstate" name="hiddenstate" value="">
     <?php echo "<input name='hdprovince' type='hidden' id='hdprovince' value='$province' />";?>
    <?php echo "<input name='hdcountry' type='hidden' id='hdcountry' value='$country' />";?>
    <?php echo "<input name='hdcity' type='hidden' id='hdcity' value='$city' />";?>
    <?php echo "<input name='hdcontinent' type='hidden' id='hdcontinent' value='$continent' />";?>
    <input type="hidden" id="hidden21" name="hidden21" value="">
    <div class="control col-md-5">
      <label class="control-label"  for="username">City *</label><br>
      <span id="citydropdown"></span>
      <?php
      $con=mysqli_connect("localhost","freedomorg","P}OaK[oW@s[U","freedomorg");
      $sql=mysqli_query($con,"SELECT id,name FROM cities WHERE name != '' order by name ASC");
if(mysqli_num_rows($sql)){
$select= '<select name="select" id="selectcity">';
while($rs=mysqli_fetch_array($sql)){
        if($rs['name']===$city)
        {
            $select.='<option selected="selected" value="'.$rs['id'].'">'.$rs['name'].'</option>';
        }
        else
        {
            $select.='<option value="'.$rs['id'].'">'.$rs['name'].'</option>';  
        }
  }
  $select.='</select>';
echo $select;
}
?>
    </div>

    <input type="hidden" id="hiddencity" name="hiddencity" value="">
    <input type="hidden" id="hidden31" name="hidden31" value="">

    <div class="row">
<div class="col-md-offset-3 col-md-9 col-lg-offset-4 col-lg-8">

<?php echo form_submit('submit', 'Submit');?> <?php echo form_close();?>

模型 overseasmember_model.php

    function updateMember($member_data,$member_id=false)
    {
        $success=false;
        $this->db->trans_start();

                $this->db->where('id', $member_id);
                $success = $this->db->update('overseas_members',$member_data);
        $this->db->trans_complete();        
        return $success;
    }

    function get_all_members($rows = 0, $limit_from = 0)
        {
        $this->db->from('overseas_members');        
        $this->db->where('deleted',0);
        $this->db->order_by("id", "asc");
        if ($rows > 0) {
            $this->db->limit($rows, $limit_from);
        }
        $query = $this->db->get();      
        $query_result = $query->result();
        return $query_result;
    }

    function getMember($member_id)
    {
        $this->db->from('overseas_members');    
        $this->db->where('id',$member_id);
        $query = $this->db->get();
        return $query->row();
    }

我没有添加视图代码,因为我收到超出代码限制的通知!如果您能帮助我,我将不胜感激,如果您需要更多代码我可以提供给您!谢谢。

0 个答案:

没有答案