Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display drive driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
PHP Help


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
sn1p34's Avatar
Senior Member with 135 posts.
 
Join Date: Feb 2005
Location: Canada
Experience: Average
12-Oct-2005, 06:46 PM #1
PHP Help
Hi guys, I'am new to PHP and I was wondering if I could get some help.

Anyways when ever I run the contact script it just give me a blank page here is the source code

PHP Code:
<?
  $name 
$_REQUEST['name'] ;
  
$email $_REQUEST['email'] ;
  
$age $_REQUEST['age'] ;
  
$message $_REQUEST['message'] ;
  
$ip getenv('REMOTE_ADDR'); 

  if (!isset(
$_REQUEST['email'])) {
    
header"Location: http://www.enertechdbi.com/~destinyprevails/email/feedback.html" );
      }    
  elseif (empty(
$email) || empty($message) || empty($name) || empty($age)) {

    
header"Expires: Mon, 20 Dec 1999 01:00:00 GMT" );
    
header"Last-Midified: " .gmdate("D, d M Y H:i:s" );
    
header"Cache-Control: no-cache, muste-revalidate" );
    
header"Pragma: no-cache" );    

    
?>

    <html>
    <head>Error</h1>
    <p>
    Oops, it appears you forgot to enter either your name, email, age or message.
    Please press the back button on your browser, and try again.
    </p>
    </body>
    </html>
    
    <?
      
}
 else {
  
mail"warcrazy@gmail.com""Feedback Form Results $ip",
     
$message"Email From $name at $email, $ip" );
  
header"Location: feedback.html" );
?>
Thanks
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
12-Oct-2005, 08:09 PM #2
The filename in a Location: header should be the absolute (full) path to the file. You also need to make sure there aren't any blank lines or spaces at the beginning or end of the PHP file.
sn1p34's Avatar
Senior Member with 135 posts.
 
Join Date: Feb 2005
Location: Canada
Experience: Average
14-Oct-2005, 08:34 PM #3
I still can't get it to work
PHP Code:
<?
  $name 
$_REQUEST['name'] ;
  
$email $_REQUEST['email'] ;
  
$age $_REQUEST['age'] ;
  
$message $_REQUEST['message'] ;
  
$ip getenv('REMOTE_ADDR'); 

  if (!isset(
$_REQUEST['email'])) {
    
header"Location: http://www.enertechdbi.com/~destinyprevails/email/feedback.html" );
      }    
  elseif (empty(
$email) || empty($message) || empty($name) || empty($age)) {

    
header"Expires: Mon, 20 Dec 2007 01:00:00 GMT" );
    
header"Last-Midified: " .gmdate("D, d M Y H:i:s" );
    
header"Cache-Control: no-cache, muste-revalidate" );
    
header"Pragma: no-cache" );    

    
?>

    <html>
    <head>
    <h1>Error</h1>
    <p>
    Oops, it appears you forgot to enter either your name, email, age or message.
    Please press the back button on your browser, and try again.
    </p>
    </body>
    </html>
    
    <?
      
}
 else {
  
mail"warcrazy@gmail.com""Feedback Form Results $ip",
     
$message"Email From $name at $email, $ip" );
  
header"Location: http://www.enertechdbi.com/~destinyprevails/email/feedback.html" );
?>
Thanks
jiml8's Avatar
Senior Member with 1,514 posts.
 
Join Date: Jul 2005
Experience: I've been at this for too long.
17-Oct-2005, 01:09 AM #4
You should be getting error messages out of this; you're ending your PHP script in the middle, then starting a new PHP script in the middle.

Your first PHP script has an if{} elseif{ structure, which is manifestly invalid, and your second PHP script starts with a right brace, then an else with no if.

Remove the ?> that is ahead of the HTML, and the <? that is after the HTML and replace them with an echo " before the HTML and a "; after the HTML.
sn1p34's Avatar
Senior Member with 135 posts.
 
Join Date: Feb 2005
Location: Canada
Experience: Average
17-Oct-2005, 01:20 AM #5
We'll I noticed it make a diffrence in the text editor it changed the color under the </html>, but it still dosen't work.

PHP Code:
<?
  $name 
$_REQUEST['name'] ;
  
$email $_REQUEST['email'] ;
  
$age $_REQUEST['age'] ;
  
$message $_REQUEST['message'] ;
  
$ip getenv('REMOTE_ADDR'); 

  if (!isset(
$_REQUEST['email'])) {
    
header"Location: http://www.enertechdbi.com/~destinyprevails/email/feedback.html" );
      }    
  elseif (empty(
$email) || empty($message) || empty($name) || empty($age)) {

    
header"Expires: Mon, 20 Dec 2007 01:00:00 GMT" );
    
header"Last-Midified: " .gmdate("D, d M Y H:i:s" );
    
header"Cache-Control: no-cache, muste-revalidate" );
    
header"Pragma: no-cache" );    

    echo
    <
html>
    <
head>
    <
h1>Error</h1>
    <
p>
    
Oopsit appears you forgot to enter either your nameemailage or message.
    
Please press the back button on your browser, and try again.
    </
p>
    </
body>
    </
html>
    
";
      }
 else {
  mail( "
warcrazy@gmail.com", "Feedback Form Results $ip",
     $message, "
Email From $name at $email$ip" );
  header( "
Locationhttp://www.enertechdbi.com/~destinyprevails/email/feedback.html" );
?>
sn1p34's Avatar
Senior Member with 135 posts.
 
Join Date: Feb 2005
Location: Canada
Experience: Average
17-Oct-2005, 01:40 AM #6
As I mentioned earlier I'm just learning PHP, I based this off a tutorial at http://www.thesitewizard.com/archive/phptutorial2.shtml and added a few things.
jiml8's Avatar
Senior Member with 1,514 posts.
 
Join Date: Jul 2005
Experience: I've been at this for too long.
17-Oct-2005, 07:16 AM #7
As I said, you put in echo " not echo.
jiml8's Avatar
Senior Member with 1,514 posts.
 
Join Date: Jul 2005
Experience: I've been at this for too long.
17-Oct-2005, 08:32 AM #8
Actually, to this point you are displaying an extremely thoughtless pattern. No one here is going to solve your problems, though we will help you identify and solve them.

To this point you put up a script, say "it doesn't work" and wait for someone to tell you what is wrong with it. You then incorporate what they say - in the case of what I told you, you incorporated it incorrectly, and obviously so - and then you say "it doesn't work" and wait for someone to tell you what to do.

So here is what I am going to tell you.

Go here: www.php.net where you will find everything you need to understand php.

When you post a question here, if you want me to answer again, you will first ensure that you have done what was requested, accurately. You then will not say "it doesn't work", you will specify the conditions under which you ran it - server OS, webserver, and how you invoked it, and you will specify what error message you received.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:54 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.