I am making a script like a shopping cart using js ajax and php.
this code lines are used to print remove when an item is saved:
if($_POST['button-statut']=='save'){
echo "remove";
unset($_POST['button-statut']);
}
if($_POST['button-statut']=='remove'){
echo "save";
$_POST['button-statut']='save';
}
When i click in the save button, the value 'save' is set and if i click in the remove button it looks like the value is stil 'save' instead of 'remove'. what can i do ?
the save function:
$.post(host+"button.php", {"button": key, "button-statut":'save'});
$('#button'+key+'').load(host +'button.php', {"button": key, "button-statut":'save'});
the remove function:
$.post(host+"button.php", {"button": key, "button-statut":'remove'});
$('#button'+key+'').load(host +'button.php', {"button": key, "button-statut":'remove'});
Thanks
These variables are superglobal :
$GLOBALS
$_SERVER
$_GET
$_POST
$_FILES
$_COOKIE
$_SESSION
$_REQUEST
$_ENV
we cannot unset or clear theis input arrays. However, what we have done is to replace them with an objec (or empty its value)