Permisi gan numpang tanya, ane kesulitan untuk merubah status agent ketika pilih jenis status yang sudah tersedia. mohon pencerahannya gan. terima kasih
berikut kosding nya gan.
<?php
if ($_SESSION)
{
include "lib/db.php";
$lang = $_REQUEST;
$qs_app= $_SERVER;
$qs1_app = explode("&",$qs_app);
$qs2_app = count($qs1_app);
$qs3_app = strpos($qs_app,"page");
if ($qs3_app == 0) {$nonpage = 0;}
else {$nonpage = 1;}
if ($nonpage == 0) {$newurl = $qs_app . "&";}
else {$newurl = str_replace("&" . $qs1_app[$qs2_app - 1],"",$qs_app);}
$query_count = "SELECT count(*) as a FROM tb_master_agent";
$result_count = mysql_query($query_count,$dbh);
$rw_count = mysql_fetch_assoc($result_count);?>
<h4 class="alert_info">Master Agent</h4>
<article class="module width_full">
<header><h3 class="tabs_involved">Registered Agent (Total = <?php echo number_format($rw_count); ?>)</h3></header>
<div class="tab_container">
<div id="tab1" class="tab_content">
<table width="729" cellspacing="0" class="tablesorter">
<thead>
<tr>
<th width="139">Agent ID</th>
<th width="170">Name</th>
<th width="140">Tlp</th>
<th width="112">Level</th>
<th width="89">Status</th>
<th width="89">Status Pilih</th>
<th width="27"></th>
<th width="36"></th>
<th width="90"></th>
</tr>
</thead>
<tbody>
<?php
$perpage = 5;
//
Head 1
if (empty($_REQUEST)) $page=1; else $page = $_REQUEST;
$queryat="SELECT * FROM tb_master_agent
ORDER BY agent_id ASC";
$resultat = mysql_query($queryat,$dbh);
$totalat = mysql_num_rows($resultat);if ($totalat % $perpage == 0){
$pagemax = floor($totalat / $perpage);
}
else{
$pagemax = floor($totalat / $perpage) + 1;
}
$temp = ($page-1)*$perpage;
//
Fin Head 1----
//
show 1
$querync="SELECT * FROM tb_master_agent
ORDER BY agent_id ASC
LIMIT ". $temp .", " . $perpage;
//
Fin Show 1
$resultnc = mysql_query($querync,$dbh);
$tutnc=mysql_num_rows($resultnc);
while ($rwnc=mysql_fetch_array($resultnc)){
?>
<tr>
<td><?php echo $rwnc; ?></td>
<td><?php echo $rwnc; ?></td>
<td><?php echo $rwnc; ?></td>
<td><?php if ($rwnc=='A') {echo "Administrator"; } else {echo "Operator";} ?></td>
<td><?php if ($rwnc=='A') {echo "Active"; } elseif ($rwnc=='F') {echo "Freeze"; } else {echo "Blocked";} ?></td>
<td><select name="combo" onchange="goToURL(this.value,<?php echo $rwnc; ?> )">
<option value="<?php echo $rwnc; ?>" <?php echo "selected"; ?>> <?php echo $nama_pesan_edit; ?></option>
<option <?php if($rwnc=='A'){echo "selected"; } ?> value='A'>Active</option>
<option <?php if($rwnc=='F'){echo "selected"; } ?> value='F'>Freeze</option>
<option <?php if($rwnc=='B'){echo "selected"; } ?> value='B'>Blocked</option>
</select></td>
<td><a href="index.php?rlink=master_agent_exe&act=f_edit&user_id=<?php echo $rwnc; ?>"><img src="images/icn_edit.png" width="16" height="16" border="0"></a></td>
<td><a href="index.php?rlink=master_agent_exe&act=f_delete&user_id=<?php echo $rwnc;?>"><img src="images/icn_alert_error.png" width="16" height="16" border="0"></a></td>
</tr>
<?php
}
if ($tutnc == 0) { echo "Tidak Ada Data."; }
?>
<script>
function goToURL($status,$id) {
<?php
$status_edit="A";
$id_agent="20150308134701";
// $sql="update tb_master_agent set status_agent='$status_edit' where agent_id='$id_agent'";
$query=mysql_query($sql) or die(mysql_error());
if ($query) {
echo " .. Data sudah di tambah ...";
//header("Location:index.php?rlink=device");
}
?>}
</script>
</tbody>
</table>
</div><!-- end of #tab1 -->
<p align="center"><?php
if ($tutnc != 0){
$qs_app= $_SERVER;
$qs1_app = explode("&",$qs_app);
$qs2_app = count($qs1_app);
$qs3_app = strpos($qs_app,"page");
if ($qs3_app == 0) {$nonpage = 0;}
else {$nonpage = 1;}
if ($nonpage == 0) {$newurl = $qs_app;}
else {$newurl = str_replace("&" . $qs1_app[$qs2_app - 1],"",$qs_app);}
if ($page > 1) {
echo "<a href=index.php?" . $newurl . "&page=1>First </a> ";
echo "<a href=index.php?" . $newurl . "&page=".($page-1).">Prev </a> ";
}
else { echo ""; }
for($lpage = 1; $lpage <= $pagemax; $lpage++){
if ((($lpage >= $page - 2) && ($lpage <= $page + 2))){
if ($lpage == $page) echo " ".$lpage." ";
else echo " <a href=index.php?" . $newurl . "&page=". $lpage .">" . $lpage . "</a> ";
}
}
if ($page < $pagemax) {
echo "<a href=index.php?" . $newurl . "&page=".($page+1)."> Next</a>";
echo "<a href=index.php?" . $newurl . "&page=".$pagemax."> Last</a>";
}
else { echo ""; }
}
?></p>
</div><!-- end of .tab_container -->
<p align="center"><a href="index.php?rlink=master_agent_exe&act=f_add">ADD NEW AGENT <img src="images/icn_add_user.png" width="17" height="17" border="0"></a></p>
</article><!-- end of content manager article -->
<div class="spacer"></div>
<?php
}
else{
header("Location:login.php");
}
?>
Silahkan
login untuk menjawab!
istilahnya ajax ni gan...
saya masih pemula juga, dan ini adalah hasil
tutorial php untuk pemula yang saya buat, coba saja lihat mungkin bisa membantu