Jump to content

Feedback form help


nitrozero

Recommended Posts

Hello, I have problems running this PHP coding, i got i from an example book called PHP by example, written by Toby Butzon, i use xampp for a local hst and scintilla to write my scripts. i get his error message when i try to run this file

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\practice\example7.2.php on line 76

 

Here is the coding which i created...Thank you!

 

<?php

/* feedback form multi-functio program*/

 

//make reference to form variables

$form =& $_REQUEST;

 

// define configuration settings

Define('FEEDBACK_TO', '[email protected]'); // email for webmaster

define('FEEBACK_SUbJ', 'Feedback: '); // subject prefix

 

switch ($form['step']) // decide what to do based on

{

case 1: // if step is 1, or if no know step is specified, display he form

default:

?>

 

<html>

<head><title> CHapter 7 Feedback form</title></head>

<body>

 

 

<h2> Chapter 7</h2>

 

<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">

 

<input type="hidden" name="step" value="2">

<b> NAME:</b><br />

<input type="text" name="feedback_name"><br><br>

<b> email: </b> <br>

<input type="text": name="feedback_email"><br><br>

<b> Subject: </b><br>

<select name="feedback_subj">

<option selected> Comment</option>

<option>Complaint</option>

<option>Suggestion</option>

</select><br><br>

<b>Message:</b><br />

<textarea name="feedback_msg" rows="5" cols="40"></textarea><br><br>

<input type="submit" value="Continue">

 

</form>

 

</body>

</html>

<?

 

break; // end of case 1/default for switch ($form['step'])

 

case 2: //SHOW USER HIS SUBMISSION FOR REVIEW

 

?>

<html>

<head><title> CHapter 7 feedbackform review your submission</title></head>

<body>

 

<h2> Chapter 7 feedback form </h2>

<h4> Review your submission</h4>

 

<b>name:</b></br>

<?php echo $form['feedback_name'] ?><br><br>

<b>Email:</b><br>

<?php echo $form['feedback_email'] ?><br><br>

<b>subject:</b><br>

<?php echo $form['feedback_subj'] ?> <br><br>

<b>Message</b>br />

<?php echo $form['feedback_msg'] ?><br><br>

 

<form action="<?php echo $_SERVER['$PHP_SELF']; ?>" method="post">

 

<input type="hidden" name="step" value="3">

<input type="hidden" name="feedback_name" value="<?php echo $form['feedback_name'] ?>">

<input type="hidden" name="feedback_email" value="<?php echo $form['feedback_email'] ?>">

<input type="hidden" name="feedback_subj" value="<?php echo $form['feedback_sub'] ?>">

<input type="hidden" name="feedback_msg" value="<?php echo$form['feedback_msg'] >">

 

<input type="button" value="back" onClick="javascript:history.go(-1);">

<input type="submit" value="Send">

 

</form>

 

</body>

</html>

<?php

 

break; //end of case 2 for switch ($form['step'])

 

case 3: //send feedback and show thank you page

//send feedback

$feedback_subj = FEEDBACK_SUBJ . $form['feedback_subj'];

$feedback_body = <<<END

Name: {$form['feedback_name']}

Email: {$form['feedback_email']}

Subject: {$form['feedback_subj']}

Message: {$form['feedback_msg']}

END;

mail(feedback_TO, $feedback_subj, $feedback_body);

 

//show thank you page

 

 

?>

 

<html>

<head><title> CHapter 7 feedback form thank you</title></head>

<body>

<h2> Chapter 7 feedback form</h2>

<h4> THank you </h4>

 

Your feedback ahs been sent!

 

</body>

</html>

<?php

break; //end of case 3 for swtiching ($form['step'])

}

 

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/208370-feedback-form-help/
Share on other sites

<?php
/* feedback form multi-functio program*/

//make reference to form variables
$form =& $_REQUEST;

// define configuration settings
Define('FEEDBACK_TO', '[email protected]'); // email for webmaster
define('FEEBACK_SUbJ', 'Feedback: '); // subject prefix

switch ($form['step']) // decide what to do based on
{
   case 1:         // if step is 1, or if no know step is specified, display he form
   default:         
?>

<html>
<head><title> CHapter 7 Feedback form</title></head>
<body>

   
<h2> Chapter 7</h2>
   
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
   
<input type="hidden" name="step" value="2">
<b> NAME:</b><br />
   <input type="text" name="feedback_name"><br><br>
<b> email: </b> <br>
   <input type="text": name="feedback_email"><br><br>
<b> Subject: </b><br>
   <select name="feedback_subj">
   <option selected> Comment</option>
   <option>Complaint</option>
   <option>Suggestion</option>
   </select><br><br>
<b>Message:</b><br />
   <textarea name="feedback_msg" rows="5" cols="40"></textarea><br><br>
<input type="submit" value="Continue">

</form>

</body>
</html>
<?

   break; // end of case 1/default for switch ($form['step'])
   
   case 2:            //SHOW USER HIS SUBMISSION FOR REVIEW
   
?>
<html>
<head><title> CHapter 7 feedbackform review your submission</title></head>
<body>

<h2> Chapter 7 feedback form </h2>
<h4> Review your submission</h4>

<b>name:</b></br>
   <?php echo $form['feedback_name'] ?><br><br>
<b>Email:</b><br>
   <?php echo $form['feedback_email'] ?><br><br>
<b>subject:</b><br>
   <?php echo $form['feedback_subj'] ?> <br><br>
<b>Message</b>br />
   <?php echo $form['feedback_msg'] ?><br><br>
   
<form action="<?php echo $_SERVER['$PHP_SELF']; ?>" method="post">
   
<input type="hidden" name="step" value="3">
<input type="hidden" name="feedback_name" value="<?php echo $form['feedback_name'] ?>">
<input type="hidden" name="feedback_email" value="<?php echo $form['feedback_email'] ?>">
<input type="hidden" name="feedback_subj" value="<?php echo $form['feedback_sub'] ?>">
<input type="hidden" name="feedback_msg" value="<?php echo$form['feedback_msg'] ?>">

<input type="button" value="back" onClick="javascript:history.go(-1)">
<input type="submit" value="Send">

</form>

</body>
</html>
<?php

   break; //end of case 2 for switch ($form['step'])
   
   case 3:         //send feedback and show thank you page
   //send feedback
   $feedback_subj = FEEDBACK_SUBJ . $form['feedback_subj'];
   $feedback_body = <<<END
Name: {$form['feedback_name']}
Email: {$form['feedback_email']}
Subject: {$form['feedback_subj']}
Message: {$form['feedback_msg']}
END;
   mail(feedback_TO, $feedback_subj, $feedback_body);
   
   //show thank you page
   
   
?>

<html>
<head><title> CHapter 7 feedback form thank you</title></head>
<body>
<h2> Chapter 7 feedback form</h2>
<h4> THank you </h4>

Your feedback ahs been sent!

</body>
</html>
<?php
   break; //end of case 3 for swtiching ($form['step'])
}

?>

Link to comment
https://forums.phpfreaks.com/topic/208370-feedback-form-help/#findComment-1088914
Share on other sites

[*]Read some of these: http://www.google.nl/search?sourceid=chrome&ie=UTF-8&q=Parse+error:+syntax+error,+unexpected+T_STRING,+expecting+','+or+';'+i

[*]Read your own error message

[*]Go to the line stated in your error message

[*]Try to find the error yourself

 

This should get you started. It's an error you're gonna make many many times, so you better know how to fix it yourself.

Link to comment
https://forums.phpfreaks.com/topic/208370-feedback-form-help/#findComment-1088955
Share on other sites

Agreed!  :D

 

[*]Read some of these: http://www.google.nl/search?sourceid=chrome&ie=UTF-8&q=Parse+error:+syntax+error,+unexpected+T_STRING,+expecting+','+or+';'+i

[*]Read your own error message

[*]Go to the line stated in your error message

[*]Try to find the error yourself

 

This should get you started. It's an error you're gonna make many many times, so you better know how to fix it yourself.

Link to comment
https://forums.phpfreaks.com/topic/208370-feedback-form-help/#findComment-1089012
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.