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 = "info@gsxtreme.co.uk"; 
$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!

Link to comment
Share on other sites

<?php

$adminaddress = "info@gsxtreme.co.uk"; 
$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().

Link to comment
Share on other sites

ok i fixed it like this:

 

<?php

$adminaddress = "info@gsxtreme.co.uk"; 
$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

Link to comment
Share on other sites

new code:

 

<?php

$adminaddress = "info@gsxtreme.co.uk"; 
$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...

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.