We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50966
    • 5 Posts
    Hey Guys,

    So I have a contact page that links to mail.php which i have uploaded into a folder in assets but i cannot get that and my html to link, heres a snippet of how the code looks like on my contact page/form
     <!-- Start Contact Form -->
                        	<div id="contact-form" class="contact-form">
                                <div class="loader"></div>
                        		<form action="mail.php class="contactForm" name="cform" method="post">
                                	<div class="row">


    Is there any way for me to link that back to the mail.php file in order for the contact form to work ?

    any help would be much appreciated
    thanks!
      • 49637
      • 10 Posts
      Hi,

      you have to change
      action="mail.php
      into
      action="path/to/assets/mail.php"
      and don't forget the " at the end.

      By the way you can use plugins like FormIT to handle contact forms in MODX.

        • 22840
        • 1,572 Posts
        Quote from: admin24 at Aug 24, 2015, 10:32 AM
        Hey Guys,

        So I have a contact page that links to mail.php which i have uploaded into a folder in assets but i cannot get that and my html to link, heres a snippet of how the code looks like on my contact page/form
         <!-- Start Contact Form -->
                            	<div id="contact-form" class="contact-form">
                                    <div class="loader"></div>
                            		<form action="mail.php class=" contactform"="" name="cform" method="post">
                                    	<div class="row">


        Is there any way for me to link that back to the mail.php file in order for the contact form to work ?

        any help would be much appreciated
        thanks!</div></form></div>

        Your missing the ending " after the form action, should be:

        <form action="mail.php" class="contactform"="" name="cform" method="post">

          • 50966
          • 5 Posts
          Quote from: paulp at Aug 24, 2015, 11:01 AM
          Quote from: admin24 at Aug 24, 2015, 10:32 AM
          Hey Guys,

          So I have a contact page that links to mail.php which i have uploaded into a folder in assets but i cannot get that and my html to link, heres a snippet of how the code looks like on my contact page/form
           <!-- Start Contact Form -->
                              	<div id="contact-form" class="contact-form">
                                      <div class="loader"></div>
                              		<form action="mail.php class=" contactform"="" name="cform" method="post">
                                      	<div class="row">


          Is there any way for me to link that back to the mail.php file in order for the contact form to work ?

          any help would be much appreciated
          thanks!</div></form></div>

          Your missing the ending " after the form action, should be:

          <form action="mail.php" class="contactform" =""="" name="cform" method="post">

          </form>
          still doesnt seem to work, could it be the php file ?
            • 50966
            • 5 Posts
            Quote from: steffen-s at Aug 24, 2015, 10:54 AM
            Hi,

            you have to change
            action="mail.php
            into
            action="path/to/assets/mail.php"
            and don't forget the " at the end.

            By the way you can use plugins like FormIT to handle contact forms in MODX.

            I have tried that, it didnt seem to work, the page doesnt load at all after clicking submit, heres the php could there be something wrong with this ?
            <?php
            // declare our variables
            $name = $_POST['name'];
            $email = $_POST['email'];
            $message = nl2br($_POST['message']);
            
            // set a title for the message
            $subject = "Message from Your Website";
            $body = "From $name, \n\n$message";
            $headers = 'From: '.$email.'' . "\r\n" .
                'Reply-To: '.$email.'' . "\r\n" .
            	'Content-type: text/html; charset=utf-8' . "\r\n" .
                'X-Mailer: PHP/' . phpversion();
            
            // put your email address here
            mail("*****@gmail.com", $subject, $body, $headers);
            ?>
            <!--Display a thankyou message in the callback -->
            <div class="mail_response">
                <h4>Thank you <?php echo $name ?>!</h4>
                <p>We'll be in touch real soon!</p>
            </div>    
              • 3749
              • 24,544 Posts
              Have you looked at SPForm to see if it meets your needs? It will set almost everything up for you.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 50966
                • 5 Posts
                Quote from: BobRay at Aug 24, 2015, 07:08 PM
                Have you looked at SPForm to see if it meets your needs? It will set almost everything up for you.
                I attempted to use it but struggled a little but, im giving formIT a go but not too sure how to go about it, thanks