variable not being recognized by certain browsers

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cone13cone
Forum Newbie
Posts: 24
Joined: Fri Mar 20, 2009 8:32 pm

variable not being recognized by certain browsers

Post 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
Last edited by cone13cone on Fri Mar 20, 2009 10:13 pm, edited 6 times in total.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: variable not being recognized by certain browsers

Post 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]
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: variable not being recognized by certain browsers

Post 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?
cone13cone
Forum Newbie
Posts: 24
Joined: Fri Mar 20, 2009 8:32 pm

Re: variable not being recognized by certain browsers

Post 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.
Post Reply