php - How can you remove last parameter from a $_GET URL when using the QUERY_STRING? -
since i'm using foreach loop, parameters shown. have several parameters want include url, want remove last parameter , it's value automatically showing. code follows:
<?php $query = explode('&', $_server['query_string']); $params = array(); foreach( $query $param ) { list($name, $value) = explode('=', $param, 2); echo $params[urldecode($name)][] = urldecode($value); echo "<br/>"; } echo "<br/> total amount placed: ".$total = $_get["total"]; ?>
the url one:
confirmation.php?betslip=juve&betslip=milan&total=0.43
as can see url consists of several items inside betslip parameter, , consists total of items. want remove total displaying in foreach loop , able display whenever call it.
thanks
daviddomain right. alternatively unset specific key value pair in array, if can't guarantee it'll last array element.
$params = $_get; unset($params['total']); // $params array('betslip' => 'juve', 'betslip' => 'milan');
Comments
Post a Comment