0

我有一个提交时不会刷新的表单。我看到它部分工作,但发布数据的部分似乎不起作用。任何人都可以帮我修复此表单以发布应有的数据

代码:

<script>
$(function(){
$("#submit_status").click(function(){
var status=$("#Status").val();
//
$.post("edit_status.php",{"Status":status,"client_id":<? echo $client_id ?>},function(){

});
});
})
</script>
<form name="statusF" id="statusF" method="post" action="edit_status.php" enctype="multipart/form-data">
<input type="text" id="client_id" name="client_id" style="display: none;" value="<? echo $client_id ?>" /> 
<table width="100%" border="0">
  <tr>
  <td>Status</td>
    <td>

    <?
    if ($status == "ACTIVE") {
$status_selectionA = "selected";
$status_selectionN = "";    
}
else{
    $status_selectionA = "";
$status_selectionN = "selected";
}
?>
    <select name="Status" id="Status" style="background-color: rgba(110, 225, 253, 0.62);border: none;height: 50px;font-style: italic;width: 290px;padding: 10px;margin: 5px;color: #358fa7;font-size: 14pt;font-family: Neo Sans Light, Verdana, Tahoma;border: none;float: left;" class="required">

<option value="YES" title="YES" <? echo $status_selectionA; ?>>Active</option>
    <option value="NO" title="NO" <? echo $status_selectionN; ?>>Not active</option>

</select>

    </td>
    <td><input type="submit" onclick="return false;" name="submit" style="display: none;" id="submit">
<label for="submit" class="add-client-button" style="margin:0;float: right;" id="submit_status">SAVE</label>

</td>
  </tr>
</table>
</form> 
4

1 回答 1

0

使用下面的代码..工作正常...

<?php $client_id= 0; ?>
<form name="statusF" id="statusF" method="post" action="edit_status.php" enctype="multipart/form-data">
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(function(){
$("#submit_status").click(function(){
var status=$("#Status").val();

    $.post("edit_status.php",{"Status":status,"client_id":<? echo $client_id ?>},function(){
    });
});
});
</script>


<input type="text" id="client_id" name="client_id" style="display: none;" value="<? echo $client_id ?>" /> 
<table width="100%" border="0">
  <tr>
  <td>Status</td>
    <td>

    <?
    if ($status == "ACTIVE") {
$status_selectionA = "selected";
$status_selectionN = "";    
}
else{
    $status_selectionA = "";
$status_selectionN = "selected";
}
?>
    <select name="Status" id="Status" style="background-color: rgba(110, 225, 253, 0.62);border: none;height: 50px;font-style: italic;width: 290px;padding: 10px;margin: 5px;color: #358fa7;font-size: 14pt;font-family: Neo Sans Light, Verdana, Tahoma;border: none;float: left;" class="required">

<option value="YES" title="YES" <? echo $status_selectionA; ?>>Active</option>
    <option value="NO" title="NO" <? echo $status_selectionN; ?>>Not active</option>

</select>

    </td>
    <td><input type="submit" onclick="return false;" name="submit" style="display: none;" id="submit">
<label for="submit" class="add-client-button" style="margin:0;float: right;" id="submit_status">SAVE</label>

</td>
  </tr>
</table>
</form> 
于 2013-10-01T08:54:45.423 回答