Mixing PHP and HTML - blank page results ...
Moderator: General Moderators
Mixing PHP and HTML - blank page results ...
I've made a site with a script which forces users to tick an "accept" box before getting access to a new page. The "spit back" works fine, but when the user fulfils the criteria (ticks the box) the page they're directed to appears blank. It's not blank - I know this, because I can see it in GoLive!
Code for the resulting "blank" page is below.
Anyone?
Thanks
Simon
Code for the resulting "blank" page is below.
Anyone?
Thanks
Simon
Last edited by simon-b on Sun Jul 29, 2007 6:04 pm, edited 1 time in total.
Looks like you've got embedded double quotes there.echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
In general, a blank page is usually caused by a syntax error in the PHP, causing the web server to gag and send nothing beyond any HTML that precedes the first PHP block containing the error. You can check this by viewing the source page.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Thanks Califdon
The source code showing on the blank page in the browser is as below. Can you suggest a fix for a code-challenged PHP newbie ... ??
The source code showing on the blank page in the browser is as below. Can you suggest a fix for a code-challenged PHP newbie ... ??
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD>
<BODY></BODY></HTML>That is very odd. As you can see from your own HTML, that doesn't seem to be coming from the file you showed us. You showed us a file with several META tags and several arguments in the BODY tag, in plain HTML, which do not appear in the page source. As far as I can see, there's no way that page could have been generated from the file you showed us, regardless of PHP.simon-b wrote:Thanks Califdon
The source code showing on the blank page in the browser is as below. Can you suggest a fix for a code-challenged PHP newbie ... ??
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD> <BODY></BODY></HTML>
Sorry, I'm still mystified by the Aussie talk, but that's okay.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
The only redirect you have in your code is inside this block:
Which is assigning not evaluating. Also, based on that mash of totally non-compliant markup, I would guess that goLive will show you just about anything even it is broken. Blank pages are usually a sign of a parse error, so I would check your error logs as well. Also, as per the HTTP spec, header redirects should be to full URI's not relative ones like you are using.
Code: Select all
if ($spit = "true"){- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Couple of other things...
Your checkbox check is looking for checked (which is a javascript value). PHP uses 'on'. Generally doing !empty() on a checkbox will tell you if it is checked or not.
Also, you are extracting from $HTTP_POST_VARS. Long superglobal arrays are deprecated. You should be using $_POST instead.
Your checkbox check is looking for checked (which is a javascript value). PHP uses 'on'. Generally doing !empty() on a checkbox will tell you if it is checked or not.
Also, you are extracting from $HTTP_POST_VARS. Long superglobal arrays are deprecated. You should be using $_POST instead.