Modal operation with php


Topic: Modal operation with php

Ivan Incera (Mundo gamer) pro asked 6 years ago

Hello, I do not know how to make modals either for login or contact forms, since there is no <form> tag in the code that you put, so I can not do a POST method or any action to make this work. Could you give me an example?


gianlucagiacometti pro premium priority answered 6 years ago

You may do this:

1. insert a <form> tag with an id, insert all your hidden <input> (optional) and insert an id to the <button>

<div class="modal-body">
<form id="contact-form" name="contact-form" action="#" method="POST">
<input type="hidded" name="myvariable" value="myvalue"> (optional)
... your modal content
<button id="contact-button" class= ... >
</form>
</div>

2. insert this javascript on document ready or online inside a <script> tag

$("#contact-button").on('click', function() {
$("#contact-form").submit();
});

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.10
  • Device: computer
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No
Tags
php