[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

How to add "file attachment" to my form and PHP script

Asked by HarmonicMinor in PHP Scripting Language

Tags: form, php, example

** FYI - I did look at examples here on EE and by googling and was still bit unsure on how to add it properly...


I'm not too savvy with PHP but was able to utilize this "Feedback.php" script that was available on the net.   It works fine with the basic "feedback me" form I created to utilize this php file that resides on the hosting server and all responses including title of email and subject are properly sent to my email account.  

What line(s) of code is needed to this script to allow a user to add an attachment to their feedback (i.e. allow them to browse their hard drive and select a file on the form) to accomplish this and what HTML code is needed to add to my form?

Any help will be very much appreciated.




// ~~~~~~~~~~~~~~  feedback.php  ~~~~~~~~~~~~~~

<?


$formurl = "http://www.MySite.com/feedback.html" ;
$errorurl = "http://www.MySite.com/error.html" ;
$thankyouurl = "http://www.MySite.com/thankyou.html" ;

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

$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
      header( "Location: $formurl" );
      exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
   header( "Location: $errorurl" );
   exit ;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
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>\r\nReply-To: \"$name\" <$email>\r\nX

-Mailer: chfeedback.php 2.04" );
header( "Location: $thankyouurl" );
exit ;

?>



// ~~~~~~~~~~~~~~  feedback.htm  ~~~~~~~~~~~~~~

<html>
<head>
<title></title>
</head>
<body>
<form action="feedback.php" method="post">
  <table border="0" cellpadding="8" cellspacing="8" scrolling="no" summary="feedback form">
    <tr>
      <td>Your Name or Company:</td>
      <td><input type="text" name="name" size="32" /></td>
    </tr>
    <tr>
      <td>Your Email address:</td>
      <td><input type="text" name="email" size="32" /></td>
    </tr>
    <tr>
      <td colspan="2">Comments<br />
      <textarea rows="12" cols="52" name="comments">
</textarea> </td>
    </tr>
    <tr>
      <td align="center" colspan="2"><input type="submit" value="Send Feedback" /> <br/> </td>
    </tr>
  </table>
</form>
</body>
</html>
[+][-]02/25/06 07:08 AM, ID: 16045470Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Tags: form, php, example
Sign Up Now!
Solution Provided By: Roonaan
Participating Experts: 1
Solution Grade: A
 
[+][-]02/25/06 06:23 AM, ID: 16045338Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/06 06:44 AM, ID: 16045401Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/25/06 06:53 AM, ID: 16045429Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/06 07:09 AM, ID: 16045475Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/01/06 09:14 AM, ID: 16076902Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/01/06 09:28 AM, ID: 16077037Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/06/06 06:58 AM, ID: 16114774Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92