Home › Forums › Porto – Responsive HTML5 Template › Modifying the contact form
- This topic has 12 replies, 2 voices, and was last updated 6 years, 11 months ago by ppericles. This post has been viewed 2205 times
-
AuthorPosts
-
May 9, 2017 at 2:37 am #10020851ppericlesParticipant
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.7May 9, 2017 at 5:27 am #10020857Support2KeymasterHello,
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.
May 9, 2017 at 10:14 am #10020863ppericlesParticipantNo.
I still have the problem.Pericles
May 9, 2017 at 10:19 am #10020864ppericlesParticipantIn 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.
May 9, 2017 at 10:41 am #10020865ppericlesParticipantI 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
May 9, 2017 at 11:07 am #10020866ppericlesParticipantAll 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
May 9, 2017 at 10:20 pm #10020870Support2KeymasterHello Pericles, great you solved that issue.
Here is a FAQ topic explaining how to add more fields to 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.
May 10, 2017 at 2:59 am #10020878ppericlesParticipantThanks for this interesting FAQ.
How do I go about to add a file attachment field? Would it work in JS?Thanks,
Pericles
May 10, 2017 at 11:24 pm #10020897Support2KeymasterHello,
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.
May 11, 2017 at 1:27 am #10020901ppericlesParticipantHello,
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
May 11, 2017 at 1:55 am #10020903ppericlesParticipantThis reply has been marked as private.May 11, 2017 at 5:45 am #10020907Support2KeymasterHello.
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/4NvzmGDa3) Change the HTML of the form to this on link below:
https://pastebin.com/raw/7jFXrE6zPlease try that and let me know if you need further assistance.
Kind Regards,
Rodrigo.
May 11, 2017 at 11:00 am #10020911ppericlesParticipantYes!
It worked like a dream.Thanks.
Pericles
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.