Jump to content

rawurlencode error


GreenSmurf

Recommended Posts

This one should be pretty easy from what I understand but the problem is I do not have a full understanding. The idea is that

$group_name = $myrow["group_name"];

and the "group_name" in the database is "All Darby Clients"; so, there is a a couple spaces nothing too crazy but other group names do have other characters. For all our purposes this particular group will be fine. Here is the code displaying the link:

echo "Users added. See on <a href='index.php?group_name=".rawurlencode($group_name)."'>\"$group_name\"</a> or <a href='javascript:history.go(-1)'>Go Back.</a>";

I personally do not see an error here but I keep getting a "Problem Loading Page" error in Firefox and am not too sure as to why. When I click 'Try Again' nothing happens but if I click the URL and hit 'Enter' on the keyboard the page loads with no problem. Any suggestions or tips would be much appreciated. Thank you.

 

-Brandon

Link to comment
Share on other sites

One way to do this, is add another column "urlname" in the database. And in the urlname make it a unique key and change any special characters to something manageable, like spaces to _ or - etc. This way you do not have to worry about encoding etc and it should work.

 

Not sure if you were looking for an alternative, but yea. That is what I would do :)

Link to comment
Share on other sites

Personally I'd probably take an approach similar to what premiso suggests, it allows for more 'pretty' URLs. Having said that I don't see anything too wrong in your code. I've never personally used rawurlencode, is there a specific reason you choose this over urlencode?

No real reason for choosing one over the other. I just learned rawurlencode first and it works in my other code with similar applications.

Link to comment
Share on other sites

Still have not exactly figured out the error due to the fact that one application of rawurlencode() works and in a very similar (copy-paste) use of the code it does not.

The first one does not work.

echo "Users added. See on <a href='index.php?group_name=".rawurlencode($group_name)."'>\"$group_name\"</a> or <a href='javascript:history.go(-1)'>Go Back.</a>";[\php]
While this one does.
[code=php:0]echo "Users removed. See on <a href='index.php?group_name=".rawurlencode($group_name)."'>group page \"$group_name\"</a>.";

 

Any suggestions? I would consider making a URL for each group in the database but then I would have to change quite a bit in the database and in the code due to the fact that it has been left open-ended and generates requests on the fly rather than pulling the info from a database. The other reason is that I wanted to cut down on a need to run queries.

 

I would like to thank you in advanced for any replies and your time.

-GS

Link to comment
Share on other sites

The code you pasted there works fine for me. Are you sure the problem isn't with the decoding of the $_GET variable?!

 

I believe it has to do with the browser you are using. I am not certain but this problem seems to have vanished now that I am on Firefox 3.5.6 and not an older version or using Internet Explorer. If anyone has experienced similar problems I would like to know how it was resolved within the code or if it is just a lost cause. Thank you.

 

-GS

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.