Jump to content

[SOLVED] PHP errors for a flash based contact form


speida

Recommended Posts

Hi, i got a problem for the flash based contact form on this website (under contact) www.gsxtreme.co.uk

 

The flash side i think works fine, but the php file doesn't wanna work :( i keep getting errors of any type.

 

The PHP file is here http://www.gsxtreme.co.uk/mailform.php and if you go there you can see it gives you a Parse error.

 

This is the PHP code:

 

<?php

$adminaddress = "[email protected]"; 
$siteaddress ="http://www.gsxtreme.co.uk"; 
$sitename = "GS Xtreme Sales LTD"; 

//No need to change anything below ... 
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");

// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

// Gets the POST Headers - the Flash variables
$action = $_REQUEST['action'] ;
$email = $_REQUEST['email'] ;
$firstname = $_REQUEST['firstname'] ;
$name = $_REQUEST['name'] ;
$company = $_REQUEST['company'] ;
$city = $_REQUEST['city'] ;
$comments = $_REQUEST['comments'] ;

//Process the form data!
// and send the information collected in the Flash form to Your nominated email address

if ($action == "send") {

mail ("$adminaddress","Info Request",
"A visitor at GS Xtreme Sales LTD website has left the following information\n
Firstname: $firstname 
Email: $email\n

The visitor, $firstname, commented:
------------------------------
$comments

Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time:  $date","FROM:$yourmailadress" ) ; 

//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting GS Xtreme Sales LTD", 
"Hello $firstname,\n
Thank you for your interest in GS Xtreme Sales LTD!\n

We will get back to you within 24 hours.

Best Regards,

GS Xtreme Sales Costumer Support.  ) ;


}

?>

 

Please help me because i spent 2 hours in front of this code without luck! when i change something i get another error :(

 

Thanks!

<?php

$adminaddress = "[email protected]"; 
$siteaddress ="http://www.gsxtreme.co.uk"; 
$sitename = "GS Xtreme Sales LTD"; 

//No need to change anything below ... 
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");

// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

// Gets the POST Headers - the Flash variables
$action = $_REQUEST['action'] ;
$email = $_REQUEST['email'] ;
$firstname = $_REQUEST['firstname'] ;
$name = $_REQUEST['name'] ;
$company = $_REQUEST['company'] ;
$city = $_REQUEST['city'] ;
$comments = $_REQUEST['comments'] ;

//Process the form data!
// and send the information collected in the Flash form to Your nominated email address

if ($action == "send") {

mail ("$adminaddress","Info Request",
"A visitor at GS Xtreme Sales LTD website has left the following information\n
Firstname: $firstname 
Email: $email\n

The visitor, $firstname, commented:
------------------------------
$comments

Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time:  $date","FROM:$yourmailadress" ) ; 

//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting GS Xtreme Sales LTD", 
"Hello $firstname,\n
Thank you for your interest in GS Xtreme Sales LTD!\n

We will get back to you within 24 hours.

Best Regards,

GS Xtreme Sales Costumer Support.") ;


}

?>

 

You forgot the ending quotes in mail().

ok i fixed it like this:

 

<?php

$adminaddress = "[email protected]"; 
$siteaddress ="http://www.gsxtreme.co.uk"; 
$sitename = "GS Xtreme Sales LTD"; 

//No need to change anything below ... 
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");

// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

// Gets the POST Headers - the Flash variables
$action = $REQUEST['action'] ;
$email = $REQUEST['email'] ;
$firstname = $REQUEST['firstname'] ;
$name = $REQUEST['name'] ;
$company = $REQUEST['company'] ;
$city = $REQUEST['city'] ;
$comments = $REQUEST['comments'] ;

//Process the form data!
// and send the information collected in the Flash form to Your nominated email address

if ($action == "send") {
//
mail ("$adminaddress","Info Request",
"A visitor at GS Xtreme Sales LTD website has left the following information\n
Firstname: $firstname 
Email: $email\n

The visitor, $firstname, commented:
------------------------------
$comments

Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time:  $date, FROM:$yourmailadress ") ; 

//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting GS Xtreme Sales LTD", 
"Hello $firstname,\n
Thank you for your interest in GS Xtreme Sales LTD!\n

We will get back to you within 24 hours.

Best Regards,

GS Xtreme Sales Costumer Support. ") ;



//Confirmation is sent back to the Flash form that the process is complete
$sendresult = "Thank you. You will receive a confirmation email shortly.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo $send_answer;
}


?>

 

Now the php file at http://www.gsxtreme.co.uk/mailform.php says:

 

Notice: Undefined variable: REMOTE_ADDR in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 12

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 16

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 17

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 18

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 19

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 20

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 21

 

Notice: Undefined variable: REQUEST in /home/fhlinux169/g/gsxtreme.co.uk/user/htdocs/mailform.php on line 22

 

What do i do now? :S

new code:

 

<?php

$adminaddress = "[email protected]"; 
$siteaddress ="http://www.gsxtreme.co.uk"; 
$sitename = "GS Xtreme Sales LTD"; 

//No need to change anything below ... 
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");

// Gets the IP Address
// if ($REMOTE_ADDR == "") $ip = "no ip";
// else $ip = getHostByAddr($REMOTE_ADDR);

// Gets the POST Headers - the Flash variables
$action = $_REQUEST['action'] ;
$email = $_REQUEST['email'] ;
$firstname = $_REQUEST['firstname'] ;
$name = $_REQUEST['name'] ;
$company = $_REQUEST['company'] ;
$city = $_REQUEST['city'] ;
$comments = $_REQUEST['comments'] ;

//Process the form data!
// and send the information collected in the Flash form to Your nominated email address

if ($action == "send") {
//
mail ("$adminaddress","Info Request",
"A visitor at GS Xtreme Sales LTD website has left the following information\n
Firstname: $firstname 
Email: $email\n

The visitor, $firstname, commented:
------------------------------
$comments

Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time:  $date, FROM:$yourmailadress ") ; 

//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting GS Xtreme Sales LTD", 
"Hello $firstname,\n
Thank you for your interest in GS Xtreme Sales LTD!\n

We will get back to you within 24 hours.

Best Regards,

GS Xtreme Sales Costumer Support. ") ;



//Confirmation is sent back to the Flash form that the process is complete
$sendresult = "Thank you. You will receive a confirmation email shortly.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo $send_answer;
}


?>

 

Look at the new result in the link i previously sent...

Notices are just that...notices...they aren't an error, just php telling you that, in this case, a variable is being used before it's defined.

 

Put this at the top of your script:

 

ini_set("display_errors", 0);

 

That should hide all errors, which is recommended on a website that is visible to the world.

 

Alternately, you can "turn down" the error reporting level using this:

 

error_reporting(E_ALL ^ E_NOTICE);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.