Jump to content

PHP form process


mparlett

Recommended Posts

Hello! I am new to PHP and am trying to process a form with a PHP script, but when I test, it says I have a programming error. I don't see it. Can you help? I am working in Dreamweaver CS3. Thanks!

 

<?php

 

/*Subject and Email Variables */

 

$emailSubject = 'Survey Response';

$webMaster = '[email protected]';

 

/* gatering data variables */

 

$easyField = $_POST['easy']

$confidentialField = $_POST['confidential']

$neutralField = $_POST['neutral']

$listenedField = $_POST['listened']

$optionsField = $_POST['options']

$resourceField = $_POST['resource']

$satisfiedField = $_POST['satisfied']

$referralField = $_POST['referral']

$commentsField = $_POST['comments']

 

$body = <<<EOD

<br><hr><br>

It was easy to contact the ombuds office: $easy <br>

The Ombuds provided a safe confidential environment: $confidential <br>

The Ombuds maintained neutrality: $neutral <br>

The ombuds listened to my concerns: $listened <br>

The Ombuds helped identify options to resolve my issue: $options <br>

Could another resource have been more effective: $resource <br>

Overall I am satisfied with the Ombuds service: $satisfied <br>

How did you hear about the Ombuds office: $referral <br>

Additional comments: $comments <br>

EOD;

 

 

$headers .= "Content-type: text/html\r\n";

$success = mail($webMaster, $emailSubject, $body, $headers);

 

/* Results rendered as HTML */

 

$theResults = <<<EOD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

</head>

 

<body>

Thank you for participating in our survey!

</body>

</html>

EOD;

echo "$theResults";

 

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/133254-php-form-process/
Share on other sites

Would help if you posted the error and the line number it's on, but one big error is you are missing semi colons on each of these lines

 

$easyField = $_POST['easy']

  $confidentialField = $_POST['confidential']

  $neutralField = $_POST['neutral']

  $listenedField = $_POST['listened']

  $optionsField = $_POST['options']

  $resourceField = $_POST['resource']

  $satisfiedField = $_POST['satisfied']

  $referralField = $_POST['referral']

  $commentsField = $_POST['comments']

 

Link to comment
https://forums.phpfreaks.com/topic/133254-php-form-process/#findComment-693046
Share on other sites

lol

 

What a useful post! :D

 

Anyway, every* statement in PHP (and pretty much every programming language) requires a terminating semicolon.

 

*Except a few things like if/elseif/else statements and loops**, which don't take a semicolon.

** do/while loops need a semicolon.

Link to comment
https://forums.phpfreaks.com/topic/133254-php-form-process/#findComment-693062
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.