• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2166
  • Last Modified:

URL POST parameters syntax question

I send out emails with URLs to my clients' invoices, of the form
domain.com/invoice.php?i=123&k=456
(where k is a sort of password key)
out of several hundred clients, only one has reported a problem.
it seems that his mailreader (on a mac) is making (and displaying) the link to show
the ampersand &   as the html character code   &

and thus what he sees and clicks on is

domain.com/invoice.php?i=123&k=456

my question is:   is there a way to be fault tolerant on my end, and accept either format
for the "k"  parameters,   i.e., have the parameter literally named
amp;k

or somehow access the URL used and parse it manually (without using the benefit of $_POST )
since it does successfully open my PHP page, but the k parameter is blank

p.s.   i could just combine into one parameter, but there are other constraints and pages that i'd have to change;   thus exploring   if there's a trick that would be easier to implement

0
willsherwood
Asked:
willsherwood
  • 4
  • 4
  • 2
  • +1
3 Solutions
 
nplibCommented:
to retrieve the values from this url
domain.com/invoice.php?i=123&k=456
you have to use $_GET not POST
or to make it universal use $_RESULTS then it works with both get and post.
0
 
willsherwoodAuthor Commented:
yes of course, that URL works fine.

but as explained, the semicolon gets in the way, which is my question.

sorry if i wasn't clear
0
 
nplibCommented:
no, you need to fix it so it doens't display it as &

post the code that creates the link.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
willsherwoodAuthor Commented:
sorry i wasn't clear.
for some 500 clients it appears and functions correctly.
for one (only) client,
his email reader on a mac is somehow set to show the html code somehow.
i'm wanting to be fault tolerant for a case like that.

thus i'm specifically seeking the answer to the question:
can the variable name include ";"
or another work-around would be to
read the URL as entered and manually parse it.
0
 
nplibCommented:
yeah, but the ; will always break it.
even if you were to try something like
if (!$_GET['k']) {
    $value = $_GET['amp;'];
} else {
   $value = $_GET['k'];
}

the ; will cause all kinds of troubles, best bet if to fix it at the source.
0
 
willsherwoodAuthor Commented:
so there's no way to retrieve the URL that was used and parse it?
0
 
nplibCommented:
not if it shows up like that.
but it should be to hard to fix the problem at the source, just post the code and lets have a look see.
0
 
b0lsc0ttIT ManagerCommented:
willsherwood,

You would have to get the complete querystring and process it manually.  Since the html entity & uses the ampersand character it causes a problem when you try to "read" it from the URL.  That is a reserved character.  The best fix would be to figure out if there is a way to prevent that one email client from messing it up. :)

To have PHP get the complete querystring try ...

$_SERVER["QUERY_STRING"]

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
Steve BinkCommented:
In PHP, you could go through the entire querystring and replace any instance of "&" with "&".  That would resolve the problem in this specific instance, but it would also mean you could not use "&" in any part of the querystring as actual data.
0
 
willsherwoodAuthor Commented:
thanks to all!
QUERY_STRING was the key
0
 
b0lsc0ttIT ManagerCommented:
Your welcome!  I'm glad I could help.  This was an interesting question.  Thanks for it and the grade and points.

bol
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now