Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

$_GET not getting all params from Querystring

Posted on 2011-10-14
17
Medium Priority
?
426 Views
Last Modified: 2012-06-27
file.php?act_del=1&id_fileacc=57&idx_userrrsz=2

only last param idx_userrrsz is gettable;...
at top of page:
echo "GET: <BR>";
var_dump($_GET);
Output:
GET:
array(1) { ["idx_userrrsz"]=> string(1) "2" }
0
Comment
Question by:MartiniMon
  • 6
  • 4
  • 3
  • +2
17 Comments
 
LVL 1

Author Comment

by:MartiniMon
ID: 36969629
Note:

If I change the following param (and only this) from
act_del=1
TO
act_del1=1

Then the script works as expected.
0
 
LVL 34

Assisted Solution

by:Beverley Portlock
Beverley Portlock earned 500 total points
ID: 36969648
Using what you posted I get this

GET:
array(3) { ["act_del"]=> string(1) "1" ["id_fileacc"]=> string(2) "57" ["idx_userrrsz"]=> string(1) "2" }

Are you sure that the string you are testing is as you posted it?

0
 
LVL 1

Author Comment

by:MartiniMon
ID: 36969657
ABSOLUTELY

This is a rudimentary PHP that's why I am so astounded.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 31

Assisted Solution

by:Frosty555
Frosty555 earned 500 total points
ID: 36969706
Works fine for me as well.

Check the link here:

http://kleincs.com/sandbox/file.php?act_del=1&id_fileacc=57&idx_userrrsz=2

File.php contains:

<?php 
echo "GET: <BR>";
var_dump($_GET);
?>

Open in new window

0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 36969784
Are you sure that the initial string was not something like

file.php?act_del=1&amp;id_fileacc=57&idx_userrrsz=2

because this would display like

file.php?act_del=1&id_fileacc=57&idx_userrrsz=2

0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
ID: 36969812
This PHP program below will show you all the server variables for your server.  And if you add your query string "?act_del=1&id_fileacc=57&idx_userrrsz=2" to the end of the filename, it will show you what the server thinks you entered too.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHP Server Variables</title>
</head>
<body><h1>PHP Server Variables</h1>
<?php

//reset($_SERVER);
foreach($_SERVER as $key => $value) {
    echo "<b>$key :</b> $value<br />\n";
}

?>
</body>
</html>

Open in new window

0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 36969825
I have tried several variations and I cannot get it to behave as you describe. Is the faulty page accessible on the web?

PHP will 'mung' data in that it will change anything it does not like into an underscore so

file.php?act_del =1&id_fileacc=57&idx_userrrsz=2

with a space before the first = would become

file.php?act_del_=1&id_fileacc=57&idx_userrrsz=2
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 500 total points
ID: 36970002
Sounds like something is really broken.  Let's try some debugging.

Install the script below (shown in its entirety) and post a link to it.
Post a link to the script that is failing.
Post the entire code of the failing script in the code snippet.
Make a test with POST instead of GET (you'll need to make a form).
Add var_dump($_REQUEST) to the failing script and show us the output.
Tell us what browser you are using.

Armed with that we may be able to tell you what is awry.
0
 
LVL 1

Author Comment

by:MartiniMon
ID: 36970679
Running the script above yields this for the QS

QUERY_STRING : idx_userrrsz=2

I am using a dynamic link but have hard coded this one for testing this issue.
here is the link text coped right from the rendered source:

<a href='userFileAccess_alt2.php?act_del1=1&id_fileacc=56&idx_userrrsz=2'>Link</a>

no spaces or url encoding
note also that changing the param name no longer works either.
~~odd~~
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 36971252
I'm inclined to think you have something else going on.  It's works fine on 4 different servers that I can check right now.  Are you using 'rewrite' code in your '.htaccess' file that may be corrupting it?
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36971348
Yes. it's odd, but before we spend any more time on guessing about it, please post the information requested at ID:36970002.  That will probably be enough to find the problem.
0
 
LVL 1

Accepted Solution

by:
MartiniMon earned 0 total points
ID: 36971436
SOLVED

inappropriate usage of the semi-colon
causing the page to reload therby dropping the params that
were not being readded by qs handler of reload statement

stared at it for a couple of hours, don't know how i missed it.

Will you guys be happy if i split the points?

Thanks again the comments got me to refocus.

thanks for the assistance,

I was printing the get and post vars but looking at all the server vars helped by explicitly noting the QS.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 36971457
Fine with me.
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 36971611
I (almost) never argue about points!

Whatever you think best.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36973025
I have enough points to orbit Saturn, so I am happy with whatever you want to do.  But about this... stared at it for a couple of hours -- next time just post the code and data here and you can get a set of fresh eyes on the problem within minutes!  All the best, ~Ray
0
 
LVL 1

Author Comment

by:MartiniMon
ID: 37133486
thanks all!
0
 
LVL 1

Author Closing Comment

by:MartiniMon
ID: 37163666
Thanks for the effort!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question