note 65602 added to ref.array

From: Date: Thu, 04 May 2006 13:30:53 +0000
Subject: note 65602 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-110516@lists.php.net to get a copy of this message
Using $_GET as an array. Values that are inputted in the GET of a page (e.g. www.mysite.com/file.php?parametera=1&parameterb=2 - the parametera and parameterb), can be used in another link, transferring the parameters to another page. Use the following code: <?php $header = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?"; for ($i=0; $i<count($_GET); $i++) { $header .= key($_GET)."=".$_GET[key($_GET)]."&"; next($_GET); } $header = substr($header,0,strlen($header)-1); ?> <a href="<? echo $header; ?>&parameterc=3">Link</a> The link will be linked to the site http://www.mysite.com/file.php?parametera=1&parameterb=2&parameterc=3 Parametera and parameterb will easily be transferred to the page the link links to. You won't have to know which GET's are included. Thus, the GET-parameters are kept, and can be used on another page. This prevents using of various forms. ---- Server IP: 194.109.193.119 Probable Submitter: 84.30.5.187 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit -- http://master.php.net/note/edit/65602 Del: integrated -- http://master.php.net/note/delete/65602/integrated Del: useless -- http://master.php.net/note/delete/65602/useless Del: bad code -- http://master.php.net/note/delete/65602/bad+code Del: spam -- http://master.php.net/note/delete/65602/spam Del: non-english -- http://master.php.net/note/delete/65602/non-english Del: in docs -- http://master.php.net/note/delete/65602/in+docs Del: other reasons-- http://master.php.net/note/delete/65602 Reject -- http://master.php.net/note/reject/65602 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110516) next »