edit form php code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10039385
    Felipebprincipe
    Participant

    how should I edit contact-form.php

    with sending success and error messages.



    Template Version: 9.0.0
    #10039394
    Support
    Keymaster

    Hello, thanks for your purchase.

    If you are using contact-form-advanced.php as base for your code this is the PHP script that you need:

    <?php
    if (isset($arrResult)) {
    	if($arrResult['response'] == 'success') {
    	?>
    	<div class="alert alert-success">
    		<strong>Success!</strong> Your message has been sent to us.
    	</div>
    	<?php
    	} else if($arrResult['response'] == 'error') {
    	?>
    	<div class="alert alert-danger">
    		<strong>Error!</strong> There was an error sending your message.
    		<span class="font-size-xs mt-2 d-block"><?php echo $arrResult['errorMessage'];?></span>
    	</div>
    	<?php
    	} else if($arrResult['response'] == 'captchaError') {
    	?>
    	<div class="alert alert-danger">
    		<strong>Error!</strong> Verification failed.
    	</div>
    	<?php
    	}
    }
    ?>

    If you are using the basic one (contact-us.html) you just need to set the messages inside the FORM:

    <div class="contact-form-success alert alert-success d-none mt-4">
    	<strong>Success!</strong> Your message has been sent to us.
    </div>
    
    <div class="contact-form-error alert alert-danger d-none mt-4">
    	<strong>Error!</strong> There was an error sending your message.
    	<span class="mail-error-message text-1 d-block"></span>
    </div>

    Make sure you add those inside the FORM tag.

    Regards.


    #10039413
    Felipebprincipe
    Participant

    I’m editing the contact-form.php file

    I need to put my e-mail [email protected] to receive the messages in this message form that you have in the index-corporate-2.html file.

    <div class="col-lg-6">
    								<div class="slider-contact-form-wrapper bg-primary rounded p-5 appear-animation" data-appear-animation="fadeInLeftShorter" data-appear-animation-delay="3000" data-appear-animation-duration="1s">
    									<div class="row">
    										<div class="col text-center">
    											<h2 class="font-weight-semi-bold text-color-light text-6 mb-2">Get a Quote</h2>
    											<p class="text-color-light opacity-7 font-weight-light mb-4 px-xl-5">Enter your personal info below and let’s start talking about your new website or customized project.</p>
    										</div>
    									</div>
    									<div class="row">
    										<div class="col">
    											<form class="contact-form form-style-2 form-errors-light" action="php/contact-form.php" method="POST">
    												<div class="contact-form-success alert alert-success d-none mt-4">
    													<strong>Success!</strong> Your message has been sent to us.
    												</div>
    													<div class="contact-form-error alert alert-danger d-none mt-4">
    													<strong>Error!</strong> There was an error sending your message.
    													<span class="mail-error-message text-1 d-block"></span>
    												</div>
    												
    												<div class="row">
    													<div class="form-group col-lg-6">
    														<input type="text" value="" data-msg-required="Please enter your name." maxlength="100" class="form-control" name="name" placeholder="Your Name..." required>
    													</div>
    													<div class="form-group col-lg-6">
    														<input type="tel" value="" data-msg-required="Please enter your phone number." maxlength="100" class="form-control" name="phone" id="phone" placeholder="Your Phone..." required>
    													</div>
    												</div>
    												<div class="row">
    													<div class="form-group col mb-4">
    														<textarea maxlength="5000" data-msg-required="Please enter your message." rows="4" class="form-control" name="message" placeholder="Your Message..." required></textarea>
    													</div>
    												</div>
    												<div class="row">
    													<div class="form-group col text-center">
    														<input type="submit" value="SUBMIT" class="btn btn-dark px-4 py-3" data-loading-text="Loading...">
    													</div>
    												</div>
    											</form>
    										</div>
    									</div>
    								</div>
    							</div>

    #10039419
    Support
    Keymaster

    Open the file php/contact-form.php and enter your e-mail address and test the contact form on your server and test it:

    Important:

    For emails that are not in the same server as the website (www)) – Uncomment the settings and add the parameters for the SMTP authentication (Make sure you enter the correct settings, contact your email provider to get that information):

    Debug:

    You can enable the Debug to see the error message:


Viewing 4 posts - 1 through 4 (of 4 total)

This topic is marked as "RESOLVED" and can not rceive new replies.