Need help with an HTML form

DantechIT
DantechIT used Ask the Experts™
on
http://dantechmsp.com/tds/site_pro/index-5.html

I have a contact us page with a form that the end user submits to the site owner. It works but I need to edit what it sends me. I dont really understand how the form works (when submitted) and I don't know where to look so I can edit. Can someone please help?
Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Don't talk to me.
Commented:
Hi DantechIT,

Somewhere there is a PHP file that processes the form post and formats the email.  Poke the site files...
Your entire form is being controlled through your contact-form.js file.  You will need to dig into that (or post it here) to find how to edit your responses.

Author

Commented:
Hey, I found the file and changed it but the values after the fourth do not come up. Any ideas?

<?php
      $owner_email = $_POST["owner_email"];
      $headers = 'From:' . $_POST["email"];
      $subject = 'A message from your site visitor ' . $_POST["name"];
      $messageBody = "";
      
      $messageBody .= '<p>Visitor Name: ' . $_POST["name"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Job Title: ' . $_POST["title"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Company: ' . $_POST["company"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>EMail Address: ' . $_POST["email"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Address: ' . $_POST["address"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Phone Number: ' . $_POST["phone"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Fax: ' . $_POST["fax"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Additional Information: ' . $_POST["additional"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Literature: ' . $_POST["Literature"] . '</p>' . "\n";

      if($_POST["stripHTML"] == 'true'){
            $messageBody = strip_tags($messageBody);
      }

      try{
            if(!mail($owner_email, $subject, $messageBody, $headers)){
                  throw new Exception('mail failed');
            }else{
                  echo 'mail sent';
            }
      }catch(Exception $e){
            echo $e->getMessage() ."\n";
      }
?>

Author

Commented:
Visitor Name: dfrgsdrg

Job Title: ggergergwreg

Company: ergergerew

EMail Address: test@ergergewrg.com

Address:

Phone Number:

Fax:

Additional Information:

Literature:
You've already closed out this question and awarded points, so this one is a freebie.

Place the following code near the start of your PHP code like so:

<?php
      $owner_email = $_POST["owner_email"];
      $headers = 'From:' . $_POST["email"];
      $subject = 'A message from your site visitor ' . $_POST["name"];
      $messageBody = "";

      foreach($_POST as $key => $value) {
      echo "<script language='javascript'>alert('key = " . $key . ", value = " . $value . "');</script>";
      }

      $messageBody .= '<p>Visitor Name: ' . $_POST["name"] . '</p>' . "\n";
      $messageBody .= '<br>' . "\n";
      $messageBody .= '<p>Job Title: ' . $_POST["title"] . '</p>' . "\n";
      etc...

You should see a dialog pop up with all the posts: name, title, company, email, etc.

If you do not, then something is happening and your posts are not making it to the file.

Open a new question if you want more help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial