Jump to content

please help


bav1

Recommended Posts

hi all im trying to configure a scrpit to post the contents of a form to email but keep getting an error im sure its somthing simple but its got me

 

heres the script

 

*/

 

// ------------- CONFIGURABLE SECTION ------------------------

 

// $mailto - set to the email address you want the form

// sent to, eg

//$mailto = "[email protected]" ;

 

$mailto = '[email protected]' ;

 

// $subject - set to the Subject line of the email, eg

//$subject = "Feedback Form" ;

 

$subject = "Feedback Form" ;

 

// the pages to be displayed, eg

//$formurl = "http://www.example.com/feedback.html" ;

//$errorurl = "http://www.example.com/error.html" ;

//$thankyouurl = "http://www.example.com/thankyou.html" ;

 

$formurl = "http://www.sjmonlineretail.co.uk/forms" ;

$errorurl = "http://www.sjmonlineretail.co.uk/error.htm" ;

$thankyouurl = "http://www.sjmonlineretail.co.uk/thankyou.htm" ;

 

// -------------------- END OF CONFIGURABLE SECTION ---------------

 

$name = $_POST['name']';

$email = $_POST['email']';

$comments = $_POST['comments']';

$please quote me = $_POST['please quote me']';

$Model = $_POST['Model']';

$Memory = $_POST['Memory']';

$Rom = $_POST['Rom']';

$HDD = $_POST['HDD']';

$Misc = $_POST['Misc']';

$Software = $_POST['Software']';

$Other requirements = $_POST['Other requirements']';

 

 

$http_referrer = getenv( "HTTP_REFERER" );

 

if (!isset($_POST['email'])) {

header( "Location: $formurl" );

exit ;

}

if (empty($name) || empty($email) || empty($comments)) {

  header( "Location: $errorurl" );

  exit ;

}

if (get_magic_quotes_gpc()) {

$comments = stripslashes( $comments );

}

 

$messageproper =

 

"This message was sent from:\n" .

"$http_referrer\n" .

"------------------------- COMMENTS -------------------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" );

header( "Location: $thankyouurl" );

exit ;

 

?>

 

 

and heres the link to the contact page the the form resides any help would be much appriciated

 

http://www.sjmonlineretail.co.uk/contact.htm

 

thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/40529-please-help/
Share on other sites

Here is the error ::

 

$name = $_POST['name']';

$email = $_POST['email']';

$comments = $_POST['comments']';

$please quote me = $_POST['please quote me']';

$Model = $_POST['Model']';

$Memory = $_POST['Memory']';

$Rom = $_POST['Rom']';

$HDD = $_POST['HDD']';

$Misc = $_POST['Misc']';

$Software = $_POST['Software']';

$Other requirements = $_POST['Other requirements']';

 

use this

$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$please quote me = $_POST['please quote me'];
$Model = $_POST['Model'];
$Memory = $_POST['Memory']';
$Rom = $_POST['Rom'];
$HDD = $_POST['HDD'];
$Misc = $_POST['Misc'];
$Software = $_POST['Software'];
$Other requirements = $_POST['Other requirements'];

Link to comment
https://forums.phpfreaks.com/topic/40529-please-help/#findComment-196119
Share on other sites

hi orio

 

sorry to be a pain mate i have changed that as suggested

 

 

$name = $_POST['name'];

$email = $_POST['email'];

$comments = $_POST['comments'];

$please quote me = $_POST['please quote me'];

$Model = $_POST['Model'];

$Memory = $_POST['Memory'];

$Rom = $_POST['Rom'];

$HDD = $_POST['HDD'];

$Misc = $_POST['Misc'];

$Software = $_POST['Software'];

$Other requirements = $_POST['Other requirements'];

 

 

$http_referrer = getenv( "HTTP_REFERER" );

 

if (!isset($_POST['email'])) {

header( "Location: $formurl" );

exit ;

}

if (empty($name) || empty($email) || empty($comments)) {

  header( "Location: $errorurl" );

  exit ;

}

if (get_magic_quotes_gpc()) {

$comments = stripslashes( $comments );

}

 

$messageproper =

 

"This message was sent from:\n" .

"$http_referrer\n" .

"------------------------- COMMENTS -------------------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" );

header( "Location: $thankyouurl" );

exit ;

 

?>

 

 

but still get error

 

Parse error: syntax error, unexpected T_STRING in /home/sjmonl11/public_html/feedback.php on line 70

 

Link to comment
https://forums.phpfreaks.com/topic/40529-please-help/#findComment-196175
Share on other sites

You can't have a space in variable names.

 

Change these lines:

$Other requirements = $_POST['Other requirements'];
$please quote me = $_POST['please quote me'];

 

Into:

$Other_requirements = $_POST['Other requirements'];
$please_quote_me = $_POST['please quote me'];

 

 

Orio.

Link to comment
https://forums.phpfreaks.com/topic/40529-please-help/#findComment-196179
Share on other sites

thanks mate thats sorted the error but the mail i receive is as below and does not show all the info entered into the form

 

This message was sent from:

http://www.sjmonlineretail.co.uk/contactform.htm

------------------------- COMMENTS -------------------------

 

Comments :test comments

 

------------------------------------------------------------

 

i suspect this is somthing to do with the bottom part of the script

 

$messageproper =

 

"This message was sent from:\n" .

"$http_referrer\n" .

"------------------------- COMMENTS -------------------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" );

header( "Location: $thankyouurl" );

exit ;

 

?>

 

will this script do what i need or do i need to write one from scratch here is the form that i want the resilt posted from

http://www.sjmonlineretail.co.uk/contactform.htm

 

 

sorry to be awkward thanks for all your help

 

 

Link to comment
https://forums.phpfreaks.com/topic/40529-please-help/#findComment-196184
Share on other sites

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.