verny Posted April 6, 2007 Share Posted April 6, 2007 While creating dynamic results pages I have to pass a few values through the URL . It looks something like this: echo "<a href='{$_SERVER['PHP_SELF']}?pg=$j&n1=$n1&n2=$n2&limit=$limit'> ".$j." </a> "; The only problem is that I have to pass an operator (+,-,/,*) which has been chosen after submit: $arr = array ( 1 => "+", 2 => "-", 3 => "*", 4 => "/", ); -------------------------------- $zz = $arr[$_POST['op']]; And evaluate the results: eval("echo \$n1".$zz."\$i;"); It works just fine on the first page but I do not know how to generate the results on other pages since I don’t know how to pass the operator… Please help! Link to comment https://forums.phpfreaks.com/topic/45852-passing-values-through-url/ Share on other sites More sharing options...
desithugg Posted April 6, 2007 Share Posted April 6, 2007 umm why dont you do this // url.php?operation=add //and on the other page have something like if($_GET['operation'] == "add") { $opp = "+"; } Well I don't think you can pass + and stuff through urls but you cna use str_replace to replace all operators with [words] like change + to [addition] and than in the next file just use str replace again. Link to comment https://forums.phpfreaks.com/topic/45852-passing-values-through-url/#findComment-222827 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.