I am trying to write software that will allow me to pass variables to a php
script like:
index.php/option=contact/step=view
When I do this, I get the varibal PATH_INFO which contains
/option=contact/step=view. Now, what I want is to have the following:
$option = contact
$step = view
I tried
$myPairs = explode( /, $PATH_INFO );
while( list( $key, $val ) = each( $myPairs ) ){
if( !empty( $val ) ){
$myVar = explode( =, $val );
${$myVar[0]} = $myVar[1];
}
}
For you example URI, index.php/option=contact/step=view
you would then have
Actually, I found a simpler way:
$vars = str_replace(/,,$PATH_INFO);
parse_str($vars);
But thanks for your help...
Christopher William Wesley wrote:
$myPairs = explode( /, $PATH_INFO );
while( list( $key, $val ) = each( $myPairs ) ){
if( !empty( $val ) ){
$myVar =
3 matches
Mail list logo