Link to home
Start Free TrialLog in
Avatar of DantechIT
DantechIT

asked on

Need help with an HTML form

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
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of DantechIT
DantechIT

ASKER

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";
      }
?>
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.