lcp2000 lcp2000 - 1 year ago 60
PHP Question

Submit a Form via a Reveal Modal

I am trying to submit a form and open a modal with the forms post data on it.

Modal works fine but the form post is not passed through.

I have tried jquery/ajax but no luck.

<form id="frmTractors" method="post" action='process.php'>
<select id="tractor" name="tractor_number">

<input type="submit" value="Submit" data-reveal-id="myModal" data-reveal-ajax="process.php" />

<!-- ### MODAL ### -->
<div id="myModal" class="reveal-modal" data-reveal></div>

Answer Source

I am running something similar on a site:


<input type="hidden" id="processURL" value="process.php">
    <select id="tractor" name="tractor_number">


$(function() {  
    $( "#tractor" ).change(function(){
        var url = $('#processURL').val();
        var tractor_number = $(this).val();                 
        var postit = $.post( url, {tractor_number:tractor_number});     
        postit.done(function( data ) {

        $('#myModal').foundation('reveal', 'open');


You don't need a form, just a hidden input to hold your process file URL.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download