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 = 'melody.parlett@unt.edu';

 

/* 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
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
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
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.