anoopd Posted October 17, 2009 Share Posted October 17, 2009 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 Link to comment https://forums.phpfreaks.com/topic/178014-value-not-passing-from-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.