简体   繁体   中英

Grabbing Values Outside a Form with PHP

I'm using the following code on my site. You'll notice that there is a checkbox outside the form (Towards the bottom). I need the value of the checkbox called to send_mail.php without creating a second form, and without placing it inside the form element. Is this even possible with PHP? `

                 <h2>Search for your dream home<br />
       and save now!</h2>
                <legend>Which Areas are you interested in?</legend>
                <div class="areas row-fluid" style="text-align:left !important;">                       
                    <div class='span5' style='margin-left:0px !important;'>
                        <label>
                            <input type="checkbox" name="arrayValue[]" id="area[0]" value="test" style='margin-top:-5px !important;'> test</label>
                    </div>          
                    </div>
                <input type="button" onclick="jQuery('#myModal').modal('show')" value="CONTINUE" />


        </div>
        </div>
    </div>

<!--banner area end-->
    <!--content area 1 start-->
    <div id="content1">
        <div class="content1_in"> <span> 
<h2 style="line-height:40px;font-size:40px;padding-bottom:10px">SOME CONTENT
</span>

            <div class="img">
               <img src="http://f14.co/realtor/assets/images/phone.png" alt="" />
            </div>
        </div>
    </div>
    <!--content area 1 end-->
    <!--content area 1 start-->
    <div id="content2">
        <div class="content2_in"> <span> SOME CONTENT
 </span>

            <div class="img">
                <img src="http://f14.co/realtor/assets/images/ipad-img.png" alt="" />
                <div class="key"></div>
            </div>
        </div> 
    </div>
    <!--content area 1 end-->
    <!--content area 3 start-->
    <div id="content3">
        <div class="content3_in"> <span> 
 SOME CONTENT 

</span>

            <div class="img">
                <img src="http://f14.co/realtor/assets/images/desktop-img.png" alt="" />
            </div>
            <div class="free"></div>
        </div>
    </div>
    <!--content area 3 end-->
    <div id="footer">
        <div class="footer_in">
            This Website Is Brought To You By: Test</div>
    </div>
    <!-- Modal -->
    <div id="myModal" class="modal hide fade modal-survey" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
             <h3 id="myModalLabel" class="survey_title">What type of home are you looking for?</h3>

        </div>
        <form method="post" class="form-horizontal" id="final_form" action="send_mail.php">
        <input type="hidden" name="template" id="template" value="Buyers" />
            <div class="modal-body" >
                <div id="lead_info_1">
                    <div class="input select">
                        <div class=""></div>...

I would add a hidden input in your form.
Then, just before your post , assign the of the hidden textbox with the value of the checkbox.
(using jQuery)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM