Modifying the contact form

Home Forums Porto – Responsive HTML5 Template Modifying the contact form

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #10020851
    ppericles
    Participant

    Hello,
    I have made a book demo form, by changing the standard contact form.
    Everything works, except at the end of submission where i get a new page displaying response: success.

    Any ideas?

    Thanks,
    Pericles



    Template Version: 5.7
    #10020857
    Support2
    Keymaster

    Hello,

    I did a test here and it’s working, getting a green box with “Success! Your message has been sent to us.”.
    Do you already solved that problem ?

    Kind Regards,

    Rodrigo.


    #10020863
    ppericles
    Participant

    No.
    I still have the problem.

    Pericles


    #10020864
    ppericles
    Participant

    In Chrome, when the submit button is pressed, I get the email and chrome goes to page https://www.ims.gr/IMSWEB5/php/book-demo-form.php which displays the {“response”:”success”}.

    In IE11, when the submit button is pressed, I get the email and I am also asked to download file boo-demo-form.json.


    #10020865
    ppericles
    Participant

    I cleared to browser cache on both browsers and I am getting a different behavior.
    I get the green success line, but the email I receive has the wrong contents.
    The from and subject fields are correct, but the message contents are incorrect. Whatever may be entered in the form fields, I always get an email with contents for Name and email the same.
    Could you please check my book-demo-form.php and also the bookDemoForm section in demo-finance.js.

    In general, I am a bit confused about how forms are processed through PHP in conjunction with JS. Is there a tutorial to understand how forms are processed?

    Thanks,
    Pericles


    #10020866
    ppericles
    Participant

    All sorted out now.
    I would still appreciate a tutorial, if there is one, on how to use PHP in conjunction with JS to process forms.

    Thanks,
    Pericles


    #10020870
    Support2
    Keymaster

    Hello Pericles, great you solved that issue.

    Here is a FAQ topic explaining how to add more fields to contact form:

    How to add fields to the contact form

    In that tutorial, you can understand how the contact form works (HTML, JS and PHP).

    If you need further assistance, please contact us.

    Kind Regards,

    Rodrigo.


    • This reply was modified 6 years, 11 months ago by Support2.
    #10020878
    ppericles
    Participant

    Thanks for this interesting FAQ.
    How do I go about to add a file attachment field? Would it work in JS?

    Thanks,
    Pericles


    #10020897
    Support2
    Keymaster

    Hello,

    To use file attachments you can use the http://preview.oklerthemes.com/porto/5.7.2/contact-us-advanced.php.
    The diference from the standard contact form is that don’t use JS/AJAX to send the fields data. The JS is used only for validation of fields.

    1) Using the file contact-us-advanced.php:
    In the top of the file, you can use the Step 4 (line 82):

    // Step 4 - If you don't want to attach any files, remove that code below
    if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] == UPLOAD_ERR_OK) {
    	$mail->AddAttachment($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name']);
    }

    2) And for the attachment field, you need this code:

    <div class="row">
    	<div class="form-group">
    		<div class="col-md-12">
    			<label>Attachment</label>
    			<input type="file" name="attachment" id="attachment">
    		</div>
    	</div>
    </div>

    Please try that and let me know if you need further assistance.

    Kind Regards,

    Rodrigo.


    • This reply was modified 6 years, 11 months ago by Support2.
    #10020901
    ppericles
    Participant

    Hello,
    contact-us-advanced.php simply adds a PHP section on top of the ordinary contact-us.html.
    Is it possible to have the PHP section in a separate PHP file and retain the html file?
    I mean to have a contact-us.html file and call the PHP form processing from another file (e.g., advanced-contact-form.php).

    Thanks,
    Pericles


    #10020903
    ppericles
    Participant
    This reply has been marked as private.
    #10020907
    Support2
    Keymaster

    Hello.

    To make like you wish, is possible only using AJAX (JS), but unfortunately Porto don’t have a ready solution for the functionality to send forms with attachment with AJAX/JS.

    My suggestion to you is:
    1) Rename the “contact-us.html” to “contact-us.php”.

    2) At top of the file, include all PHP code from “contact-us-advanced.php”. You can get the code on link below (you can modify the code with your custom fields and infos).
    https://pastebin.com/raw/4NvzmGDa

    3) Change the HTML of the form to this on link below:
    https://pastebin.com/raw/7jFXrE6z

    Please try that and let me know if you need further assistance.

    Kind Regards,

    Rodrigo.


    #10020911
    ppericles
    Participant

    Yes!
    It worked like a dream.

    Thanks.
    Pericles


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

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