Page 1 of 1

variable not being recognized by certain browsers

Posted: Fri Mar 20, 2009 8:41 pm
by cone13cone
I am passing a dynamic action variable to a redirect function and I am having trouble with certain browsers recognizing it.
here is the code which works in every browser i have tested except for opera 9.64 and .... IE 7.
my code:

Code: Select all

 
<?php
if(!$_POST['selection'] && !$_SESSION['iconic']){
redirect_to("jobs.php");
}else if(!$_SESSION['iconic']){ 
    $_SESSION['iconic'] = $_POST['selection'];
    $exp = explode(",", $_POST['selection']);
    $jid = $exp[0];
    $cid = $exp[1];     
    redirect_to("".urlencode($_POST["action"]) .".php?jid=" . urlencode($jid) . "&cid=" . urlencode($cid) . "");
 
}else{
    $exp = explode(",", $_SESSION['iconic']);
    $jid = $exp[0];
    $cid = $exp[1];
    $action = $_POST['action'];
    redirect_to("".urlencode($_POST["action"]) .".php?jid=" . urlencode($jid) . "&cid=" . urlencode($cid) . "");
}
?>
Any ideas?
Like I said ive tested in Firefox and a few other less known browsers and it works fine. I just can't have this being hit or miss depending on browsers.
Thanks, John

Re: variable not being recognized by certain browsers

Posted: Fri Mar 20, 2009 9:03 pm
by Benjamin
Please use the appropriate

Code: Select all

 [ /code] tags when posting code blocks in the forums.  Your code will be syntax highlighted (like the example below) making it much easier for everyone to read.  You will most likely receive more answers too!

Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces.  You can even start right now by editing your existing post!

If you are new to the forums, please be sure to read:

[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]

If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online.  You'll find code samples, detailed documentation, comments and more.

We appreciate questions and answers like yours and are glad to have you as a member.  Thank you for contributing to phpDN!

Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]

Re: variable not being recognized by certain browsers

Posted: Sat Mar 21, 2009 12:09 am
by requinix
Where does it stop working? Before the first redirect? Second?

And another thing that's puzzled me for a while now:

Code: Select all

redirect_to("".urlencode($_POST["action"]) .".php?jid=" . urlencode($jid) . "&cid=" . urlencode($cid) . "");
What's with the "". and .""? You know it doesn't do anything, right?

Re: variable not being recognized by certain browsers

Posted: Sat Mar 21, 2009 12:16 am
by cone13cone
tasairis wrote:Where does it stop working? Before the first redirect? Second?

It works, with firefox. but with other browsers I get this error,
The requested URL /standard/.php was not found on this server.
and this is actually in the address bar "standard/.php?jid=5355&cid=CO"
So the GETS are being passed just not the $action variable.

And another thing that's puzzled me for a while now:

Code: Select all

redirect_to("".urlencode($_POST["action"]) .".php?jid=" . urlencode($jid) . "&cid=" . urlencode($cid) . "");
What's with the "". and .""? You know it doesn't do anything, right?
Yeah I know.