Jump to content

passing values through URL


verny

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.