Hi,
I am trying to get some values passed from a javascript function to a php function to toggle some value... but it is not working...Will somebody show what went wrong ....
echo '<a href="javascript:togglevalue('.$row['id'].','.$row['active'].');">';
if ($row['active']==0)
echo "Inactive";
else
echo"Active";
echo '</a>';
<script type="text/javascript">
function togglevalue(id,stateid)
{
var state;
if (stateid=='0')
{
state="Activate";
}
else if(stateid=='1')
{
state="De Activate";
}
var conBox = confirm("Are you sure you want to " +state+ " this Member" );
if(conBox){
location.href="./admin.php?activate&id="+id+"&active="+stateid ;
}else{
return;
}
}
</script>
-------------------------
if((isset($_GET['activate'])))
{
echo $_REQUEST['stateid'] .'is state id<br />';
echo $_REQUEST['id'].'is user id';
if($_REQUEST['stateid']=='0')
{
echo "Not Active";
/*$sql='update users set active="1" where users.id="'.$_REQUEST['id'].'"';
if(mysql_query($sql))
echo $sql;*/
}
elseif($_REQUEST['stateid']=='1')
{
echo "Active";
$sql='update users set active="0" where users.id="'.$_REQUEST['id'].'"';
if(mysql_query($sql))
echo $sql;
}
else
echo $_REQUEST['stateid']." Not Updated ";
}
i am getting request[id] right but not getting request[stateid] ... it would be really helpful if someone can help