My $_GET is giving blank page

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
WorldCom
Forum Commoner
Posts: 45
Joined: Sat Jun 24, 2006 8:14 am
Location: Ontario, Canada

My $_GET is giving blank page

Post by WorldCom »

Everything on the site has been working fine until the other day.
As simple passing of a variable is now giving me WSOD.

I'm calling a second page with something like page_details.php?id=2
Now I'm getting a white screen.
When I check the page just calling it directly: page_details.php and I add inside the page <?php $id=2 ?>, the page displays what it is suppose to.
This is just on the client side for people to view information.

In my admin panel I have the same problem but have done a work around.

This gives a blank screen:

Code: Select all

echo "<a href='edit_booking.php?id=$id'>$name</a>";
This works using a POST function instead of GET:

Code: Select all

echo "<form action='edit_booking.php' method='post'>";
echo "<input type='hidden' name='id' value='$id'><input type='submit' value='$name'></form>";
This is on the receiving page:

Code: Select all

if( isset($_GET['id']) ){
	$id = (int)$_GET['id'];
	} else {
	$id = (int)$_POST['id'];
}
I know that my code when I did this site is a bit outdated but the database is being accessed fine, and any queries seem to work.
Also, have other sites on this same server and the GET queries are working fine. It's only happening on this one site.

Thanks for any help.
:banghead:

Quick update:
Stripped out all of the code from the page and it still goes blank. Anytime I call a php page with php_page.php?id=2, its blank.
This must be a server side issue????

There is one other strange thing. I have a mysterious number 1 at the bottom of my pages. No idea how it gets there.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: My $_GET is giving blank page

Post by requinix »

What does your error log say?
WorldCom
Forum Commoner
Posts: 45
Joined: Sat Jun 24, 2006 8:14 am
Location: Ontario, Canada

Re: My $_GET is giving blank page

Post by WorldCom »

requinix wrote:What does your error log say?
Heres a small segment of what I could find.

99.248.105.57 - - [17/Aug/2017:08:32:37 -0400] "GET /cottage_details.php?id=35 HTTP/1.1" 200 - "http://www.beachsidecottages.com/menu.htm" "Mozilla/5.0 (Windows NT 6.1; rv:55.0) Gecko/20100101 Firefox/55.0"
207.46.13.95
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: My $_GET is giving blank page

Post by requinix »

That is the access log, not the error log.
WorldCom
Forum Commoner
Posts: 45
Joined: Sat Jun 24, 2006 8:14 am
Location: Ontario, Canada

Re: My $_GET is giving blank page

Post by WorldCom »

I'm using cPanel and when I look at the error log for the last 300 errors, it shows nothing.
I've put a support ticket in. Hopefully they can sort it out. I though it may have been something I'm doing, but it must be on the server.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: My $_GET is giving blank page

Post by requinix »

edit: Ignore that.

I think I see where this is going wrong.

1. What is the code in your config.php?
2. Add these two lines in your .htaccess just above the RewriteRule:

Code: Select all

RewriteCond %{REQUEST_FILENAME} \.php$
RewriteCond %{REQUEST_FILENAME} -f
Last edited by requinix on Fri Aug 18, 2017 5:39 am, edited 5 times in total.
Reason: ah ha
WorldCom
Forum Commoner
Posts: 45
Joined: Sat Jun 24, 2006 8:14 am
Location: Ontario, Canada

Re: My $_GET is giving blank page

Post by WorldCom »

It was my .htaccess file. I'm not sure how it got changed, but that was causing the problems. Thanks for all the help.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: My $_GET is giving blank page

Post by requinix »

Files don't just change spontaneously. You need to find out when and why it happened.
Post Reply