[PHP] URL Parsing Help

2002-01-29 Thread Shane Lambert
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

Re: [PHP] URL Parsing Help

2002-01-29 Thread Christopher William Wesley
$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

Re: [PHP] URL Parsing Help

2002-01-29 Thread Shane Lambert
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 =