ok. i have a dropdown menu. if i select student. an additional field should be added to the form and when i choose teacher..the student specific fields should be remove and teacher input fields should be added.. in short i want to remove #student_profile if i choose #teacher_profile, and vice versa.
heres my code:
Javascript
<script>
$(function() {
$(".fields").hide();
$("#role").change(function() {
switch($(this).val()){
case "3":
$(".fields").hide().parent().find("#student_profile").show();
.find("#teacher_profile").addClass('not-active');
break;
case "2":
$(".fields").hide().parent().find("#teacher_profile").show();
.find("#student_profile").addClass('not-active');
break;
}
});
});
$('#submit').click(function(){
$('div').remove('.not-active');
});
</script>
html form
<form action="add" method="post"/>
<h3>User</h3>
<div><input id="username" name="username"/></div>
<div><label for="password">Password </label> <input name="password" type="password"/></div>
div><label for="role">Role </label>
<select id="role" name="role" class="medium">
<optgroup label="Type of User">
<option value="3" />Student
<option value="2" />Teacher
</optgroup>
</select>
</div>
<div id="student_profile" class="fields">
<div class="field">
<label for="type">Course</label>
<select id="type" name="stdntCourse" class="medium">
<optgroup label="Choose Course">
<option value="BS IT" />BS IT
<option value="BS CS" />BS CS
<option value="BS IS" />BS IS
</optgroup>
</select>
</div>
</div>
<div id="teacher_profile" class="fields">
<div class="field">
<label for="type">Department/label>
<select id="type" name="stdntCourse" class="medium">
<optgroup label="Choose Course">
<option value="BS IT" />cas
<option value="BS CS" />education
<option value="BS IS" />engineering
</optgroup>
</select>
</div>
</div>
<input type="submit" id="submit" value="Add User"/>
</form>
Your html code is quite a mess (invalid) (wrong nesting, wrong self closing tags etc..)
<form action="add" method="post">
<h3>User</h3>
<div><input id="username" name="username"/></div>
<div>
<label for="password">Password </label>
<input name="password" type="password" />
</div>
<label for="role">Role </label>
<select id="role" name="role" class="medium">
<optgroup label="Type of User">
<option value="3">Student</option>
<option value="2">Teacher</option>
</optgroup>
</select>
<div id="student_profile" class="fields">
<div class="field">
<label for="type">Course</label>
<select id="type" name="stdntCourse" class="medium">
<optgroup label="Choose Course">
<option value="BS IT">BS IT</option>
<option value="BS CS">BS CS</option>
<option value="BS IS">BS IS</option>
</optgroup>
</select>
</div>
</div>
<div id="teacher_profile" class="fields">
<div class="field">
<label for="type">Department</label>
<select id="type" name="stdntCourse" class="medium">
<optgroup label="Choose Course">
<option value="BS IT">cas</option>
<option value="BS CS">education</option>
<option value="BS IS">engineering</option>
</optgroup>
</select>
</div>
</div>
<input type="submit" id="submit" value="Add User" />
</form>
In your jquery you have some issues becaus eyou use the ; at wrong places making syntax-errors
Here is a bit simplified version
$(function() {
$(".fields").hide();
$("#role").change(function() {
switch(this.value){
case "3":
$(".fields").hide()
.filter('#student_profile')
.show()
.removeClass('not-active')
.end()
.filter('#teacher_profile')
.addClass('not-active');
break;
case "2":
$(".fields").hide()
.filter('#teacher_profile')
.show()
.removeClass('not-active')
.end()
.filter('#student_profile')
.addClass('not-active');
break;
}
}).change();
$('#submit').click(function(){
$('div').remove('.not-active');
});
});
You also need to invoke the .change() at the first time manually to initialize the form.
Working demo at http://jsfiddle.net/gaby/qTgGY/1/
Related
I have a database driven table where the last column in the table contains a form that repeats for each row. I want to have a day_inperson field show if the value in the spring_2021_status field is equal to "Both" Since the form is repeated on the page, it doesn't work.
Here is my code for the repeating form. The form itself works fine and inserts into the database. Just need the one field to show if it meets the value of "Both":
<form id="update_location" name="update_location" method="POST">
<div class="form-group">
<br>
<strong>Select a New Location:</strong>
<select class="form-control" id="spring_2021_status" name="spring_2021_status">
<option></option>
<option value="In Person" <?php if (!(strcmp('In Person', ($survey->getColumnVal("spring_2021_status"))))) { echo "selected=\"selected\"";} ?>>In Person</option>
<option value="Remote" <?php if (!(strcmp('Remote', ($survey->getColumnVal("spring_2021_status"))))) {echo "selected=\"selected\"";} ?>>Remote</option>
<option value="Both" <?php if (!(strcmp('Both', ($survey->getColumnVal("spring_2021_status"))))) {echo "selected=\"selected\"";} ?>>Both</option>
<option value="N/A" <?php if (!(strcmp('N/A', ($survey->getColumnVal("spring_2021_status"))))) {echo "selected=\"selected\"";} ?>>N/A</option>
</select>
<br>
<script>
$('#spring_2021_status').on('change',function(){
if( $(this).val()==="Both"){
$("#update_status2").show()
}
else{
$("#update_status2").hide()
}
});
</script>
<div class="row" id="update_status2" style="display:none;">
<div class="col mb-2"><label for="days_inperson"><strong>Which days?</strong> (Hold down CTRL to select multiple ones)</label>
<select multiple class="form-control" id="days_inperson" name="days_inperson">
<option value="Mon">Mon</option>
<option value="Tues">Tues</option>
<option value="Wed">Wed</option>
<option value="Thurs">Thurs</option>
<option value="Fri">Fri</option>
</select>
</div>
</div>
<strong>Add Note:</strong>
<textarea id="notes" name="notes" rows="4" cols="50">
<?php echo($survey->getColumnVal("notes")); ?></textarea>
</div>
<input type="hidden" value="<?php echo($survey->getColumnVal("theein")); ?>" name="ein" id="ein">
<button type="submit" name="submit3" id="submit3" class="btn btn-info">Update Location Status</button>
</form>
You can use class selector inside your div update_status2 then whenever your select-box gets change use $(this).closest('form').find().. this line will get closest form from select-box and then find your div which you need to show/hide.
Demo Code :
//onchange of sleect
$('[name=spring_2021_status]').on('change', function() {
if ($(this).val() === "Both") {
//get closest form tag and then find your div
$(this).closest('form').find(".update_status2").show()
} else {
$(this).closest('form').find(".update_status2").hide()
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="update_location" name="update_location" method="POST">
<div class="form-group">
<br>
<strong>Select a New Location:</strong>
<select class="form-control" name="spring_2021_status">
<option></option>
<option value="In Person" selected>In Person</option>
<option value="Remote">Remote</option>
<option value="Both">Both</option>
<option value="N/A">N/A</option>
</select>
<br>
<!--added class-->
<div class="row update_status2" style="display:none;">
<div class="col mb-2"><label for="days_inperson"><strong>Which days?</strong> (Hold down CTRL to select multiple ones)</label>
<select multiple class="form-control" id="days_inperson" name="days_inperson">
<option value="Mon">Mon</option>
<option value="Tues">Tues</option>
<option value="Wed">Wed</option>
<option value="Thurs">Thurs</option>
<option value="Fri">Fri</option>
</select>
</div>
</div>
<strong>Add Note:</strong>
<textarea id="notes" name="notes" rows="4" cols="50">
something...</textarea>
</div>
<input type="hidden" value="abc" name="ein" id="ein">
<button type="submit" name="submit3" id="submit3" class="btn btn-info">Update Location Status</button>
</form>
<form id="update_location" name="update_location" method="POST">
<div class="form-group">
<br>
<strong>Select a New Location:</strong>
<select class="form-control" name="spring_2021_status">
<option></option>
<option value="In Person" selected>In Person</option>
<option value="Remote">Remote</option>
<option value="Both">Both</option>
<option value="N/A">N/A</option>
</select>
<br>
<div class="row update_status2" style="display:none;">
<div class="col mb-2"><label for="days_inperson"><strong>Which days?</strong> (Hold down CTRL to select multiple ones)</label>
<select multiple class="form-control" id="days_inperson" name="days_inperson">
<option value="Mon">Mon</option>
<option value="Tues">Tues</option>
<option value="Wed">Wed</option>
<option value="Thurs">Thurs</option>
<option value="Fri">Fri</option>
</select>
</div>
</div>
<strong>Add Note:</strong>
<textarea id="notes" name="notes" rows="4" cols="50">
something...</textarea>
</div>
<input type="hidden" value="abc" name="ein" id="ein">
<button type="submit" name="submit3" id="submit3" class="btn btn-info">Update Location Status</button>
</form>
Is there any way to write PHP code inside .twig file in WordPress? I am trying to send a mail by using the form values from a .twig template file.
page-pledgeform.twig
{% extends "base.twig" %}
{% block content %}
<body class="{{body_class}}">
<div class="wrapper">
<section id="content" role="main" class="content-wrapper">
{% block body %}
<!-- strat_body_content -->
<div class="body_content">
<div class="space_height"></div>
<div class="form_section">
<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<!-- Top Navigation -->
<div class="main clearfix">
<form id="nl-form" method="POST" action="" class="nl-form">
I am <input type="text" name="name" id="user_name" value="" placeholder="Name" data-subline="For example: <em>Mr. K. Roy</em>"/>
It is a long <input type="text" value="" placeholder="Country name" data-subline="For example:
<em>India</em>"/>
Gender
<select>
<option value="1" selected>Male</option>
<option value="2">Female</option>
<option value="3">Other</option>
</select>
Lorem
<select>
<option value="1" selected>O</option>
<option value="2">B</option>
<option value="3">B+</option>
<option value="4">B-</option>
<option value="2">A-</option>
</select>
.
There are many <input type="text" value="" placeholder="Address" data-subline="For example: <em>Los Angeles</em> or <em>New York</em>"/>
passages of
<select>
<option value="1" selected>Mumbai</option>
<option value="2">Delhi</option>
<option value="3">Bangalore</option>
<option value="4">Hyderabad</option>
<option value="5">Ahmedabad</option>
<option value="6">Kolkata</option>
</select>
classical Latin
<select>
<option value="1" selected>Gujarat</option>
<option value="2">Andhra Pradesh</option>
<option value="3">Tamil Nadu</option>
<option value="4">Maharashtra</option>
<option value="5">West Bengal</option>
</select>
first true
<select>
<option value="1" selected>Vijayawada</option>
<option value="2">Kanyakumari</option>
<option value="3">Rewalsar</option>
<option value="4">Dehradun</option>
<option value="2">24 parganas</option>
</select>
There are many <input type="text" value="" placeholder="Pin code" data-subline="For example: <em>700049</em>"/>
There are <input type="email" value="" placeholder="Email ID" data-subline="For example: <em>mac#gmail.com</em>"/>
Phone <input type="number" value="" placeholder="Phone Number" data-subline="For example: <em>000-123-000</em>"/>
Mobile number <input type="number" value="" placeholder="Mobile Number" data-subline="For example: <em>000-123-000</em>"/>
My information may be shared with the
<select>
<option value="1" selected>Yes</option>
<option value="2">No</option>
</select>
<div class="nl-overlay"></div>
<br><br><br>
<h4>Emergency Contact Person Details :-</h4>
I am <input type="text" name="name" value="" placeholder="Name" data-subline="For example: <em>Mr. k. Roy</em>"/>
It is a long <input type="text" value="" placeholder="Country name" data-subline="For example: <em>India</em>"/>
Gender
<select>
<option value="1" selected>Male</option>
<option value="2">Female</option>
<option value="3">Other</option>
</select>
Lorem
<select>
<option value="1" selected>O</option>
<option value="2">B</option>
<option value="3">B+</option>
<option value="4">B-</option>
<option value="2">A-</option>
</select>
.
There are many <input type="text" value="" placeholder="Address" data-subline="For example: <em>India</em>"/>
passages of
<select>
<option value="1" selected>Mumbai</option>
<option value="2">Delhi</option>
<option value="3">Bangalore</option>
<option value="4">Hyderabad</option>
<option value="5">Ahmedabad</option>
<option value="6">Kolkata</option>
</select>
classical Latin
<select>
<option value="1" selected>Gujarat</option>
<option value="2">Andhra Pradesh</option>
<option value="3">Tamil Nadu</option>
<option value="4">Maharashtra</option>
<option value="5">West Bengal</option>
</select>
first true
<select>
<option value="1" selected>Vijayawada</option>
<option value="2">Kanyakumari</option>
<option value="3">Rewalsar</option>
<option value="4">Dehradun</option>
<option value="2">24 parganas</option>
</select>
There are many <input type="text" value="" placeholder="Pin code" data-subline="For example: <em>700049</em>"/>
There are <input type="email" value="" placeholder="Email ID" data-subline="For example: <em>mac#gmail.com</em>"/>
Phone <input type="number" value="" placeholder="Phone Number" data-subline="For example: <em>000-123-000</em>"/>
Mobile number <input type="number" value="" placeholder="Mobile Number" data-subline="For example: <em>000-123-000</em>"/>
My information may be shared with the
<select>
<option value="1" selected>Yes</option>
<option value="2">No</option>
</select>
<div class="clearfix"></div>
<div class="nl-submit-wrap" style="float: right;">
<button class="nl-submit" name="submit" id="btnSubmit" type="submit">Agree & Submit</button>
</div>
<div class="clearfix"></div>
<div class="nl-overlay"></div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extrajs %}
<script src="{{theme.link}}/js/nlform.js"></script>
<script>
var nlform = new NLForm( document.getElementById( 'nl-form' ) );
</script>
<script>
var emargency = new NLForm( document.getElementById( 'emargency' ) );
</script>
{% endblock %}
</div>
</body>
</html>
{% endblock %}
twig is not like blade, you can't write php code inside.
However, you can write your own twig extensions:
https://symfony.com/doc/current/templating/twig_extension.html
please be sure to separate your twig extension from your logic (send mail), add this functionality on a service and bridge both (service & twig extension).
Before anyone yells Repost, there aren't many cases like mine that I've seen.I have a contact form that has the possibility to have a main Select option, a sub-Select option and then a sub-Select option of that one. Overall, There are 27 options to choose from and I think I could make the php give me all 27 of those and then do a "yes they selected this one but not that one" type of report, but I digress.How do I have the php script for my contact form send only what is selected from a possible three-tiered select menu? EDIT: I'm totally willing to use something other than PHP to help facilitate this, I just need help with the PHP script as well.Edit: To be clear, I'm try to create and populate a php script, not valdiate the form/check that all required sections are filled out.Code
<form action="sending.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Name:<br>
<input name="name" type="text" value="" size="30"/><br>
Email:<br>
<input name="email" type="text" value="" size="30"/><br>
Service:<br>
<select name="service" id="service" class="service">
<option>Select a Service</option>
<option value="screen" data-target="devices" id="screen">Screen Replacement</option>
<option value="comp" data-target="comp" id="comp">Computer Work</option>
<option value="misc" data-target="misc" id="misc">Miscellaneous</option>
</select>
<div style="display:none" id="service-devices">
<select name="devices" id="devices" class="devices">
<option>Select a Device</option>
<option value="iphone" data-target="iphones" id="iphone">iPhone</option>
<option value="ipad" data-target="ipads" id="ipad">iPad</option>
<!--<option value="watch" id="watch">Apple Watch</option> -->
<option value="android" id="android">Android</option>
</select>
<div style="display:none" id="devices-iphones">
<select name="iphone" id="iphone" class="iphone">
<!--<option value="iphone6s" id="iphone6s">iPhone 6S</option> -->
<!--<option value="iphone6splus" id="iphone6splus">iPhone 6S Plus</option>-->
<option>Select a Model</option>
<option value="iphone6" id="iphone6">iPhone 6</option>
<option value="iphone6plus" id="iphone6plus">iPhone 6 Plus</option>
<option value="iphone5s" id="iphone5s">iPhone 5S</option>
<option value="iphone5c" id="iphone5c">iPhone 5C</option>
<option value="iphone5" id="iphone5">iPhone 5</option>
<option value="iphone4s" id="iphone4s">iPhone 4S</option>
<option value="iphone4" id="iphone4">iPhone 4</option>
</select>
</div>
<div style="display:none" id="devices-ipads">
<select name="ipad" id="ipad" class="ipad">
<option>Select a Model</option>
<option value="ipadmini3" id="ipadmini3">iPad Mini 3</option>
<option value="ipadmini2" id="ipadmini2">iPad Mini 2</option>
<option value="ipadair" id="ipadair">iPad Air</option>
<option value="ipad4" id="ipad4">iPad 4</option>
<option value="ipad3" id="ipad3">iPad 3</option>
<option value="ipadmini" id="ipadmini">iPad Mini</option>
<option value="ipad2" id="ipad2">iPad 2</option>
</select>
</div>
</div>
<div style="display:none" id="service-comp">
<select name="compwork" id="compwork" class="compwork">
<option value="desktopcreation" id="desktopcreation">Desktop Creation</option>
<option value="desktopbuild" id="desktopbuild">Desktop Build</option>
<option value="hardwareupgrades" id="hardwareupgrades">Hardware Upgrades</option>
<option value="datarecovery" id="datarecovery">Data Recovery/Transfer</option>
<option value="spywareremoval" id="spywareremoval">Spyware/Adware Removal</option>
<option value="virusremoval" id="virusremoval">Virus Removal</option>
</select>
</div>
<div style="display:none" id="service-misc">
<select name="miscellaneous" id="miscellaneous" class="miscellaneous">
<option value="networksecurity" id="networksecurity">Network Security</option>
<!--<option value="webdesign" id="webdesign">Website Design</option>-->
</select>
</div><br>
Message:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Submit Request"/>
</form>
I assume that you do have jquery to display the relevant select boxes upon selection of devices etc... I have made a few changes in your html form, like adding id="form" in your form tag. Also added value="" for options like "Please select Service".. Here is the code. Hope this helps.. Refer to this as well..
Jquery form submit to check empty fields
<form id="form" action="sending.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Name:<br>
<input name="name" type="text" value="" size="30"/><br>
Email:<br>
<input name="email" type="text" value="" size="30"/><br>
Service:<br>
<select name="service" id="service" class="service">
<option value="">Select a Service</option>
<option value="screen" data-target="devices" id="screen">Screen Replacement</option>
<option value="comp" data-target="comp" id="comp">Computer Work</option>
<option value="misc" data-target="misc" id="misc">Miscellaneous</option>
</select>
<div style="display:none" id="service-devices">
<select name="devices" id="devices" class="devices">
<option value="">Select a Device</option>
<option value="iphone" data-target="iphones" id="iphone">iPhone</option>
<option value="ipad" data-target="ipads" id="ipad">iPad</option>
<!--<option value="watch" id="watch">Apple Watch</option> -->
<option value="android" id="android">Android</option>
</select>
<div style="display:none" id="devices-iphones">
<select name="iphone" id="iphone" class="iphone">
<!--<option value="iphone6s" id="iphone6s">iPhone 6S</option> -->
<!--<option value="iphone6splus" id="iphone6splus">iPhone 6S Plus</option>-->
<option value="">Select a Model</option>
<option value="iphone6" id="iphone6">iPhone 6</option>
<option value="iphone6plus" id="iphone6plus">iPhone 6 Plus</option>
<option value="iphone5s" id="iphone5s">iPhone 5S</option>
<option value="iphone5c" id="iphone5c">iPhone 5C</option>
<option value="iphone5" id="iphone5">iPhone 5</option>
<option value="iphone4s" id="iphone4s">iPhone 4S</option>
<option value="iphone4" id="iphone4">iPhone 4</option>
</select>
</div>
<div style="display:none" id="devices-ipads">
<select name="ipad" id="ipad" class="ipad">
<option value="">Select a Model</option>
<option value="ipadmini3" id="ipadmini3">iPad Mini 3</option>
<option value="ipadmini2" id="ipadmini2">iPad Mini 2</option>
<option value="ipadair" id="ipadair">iPad Air</option>
<option value="ipad4" id="ipad4">iPad 4</option>
<option value="ipad3" id="ipad3">iPad 3</option>
<option value="ipadmini" id="ipadmini">iPad Mini</option>
<option value="ipad2" id="ipad2">iPad 2</option>
</select>
</div>
</div>
<div style="display:none" id="service-comp">
<select name="compwork" id="compwork" class="compwork">
<option value="desktopcreation" id="desktopcreation">Desktop Creation</option>
<option value="desktopbuild" id="desktopbuild">Desktop Build</option>
<option value="hardwareupgrades" id="hardwareupgrades">Hardware Upgrades</option>
<option value="datarecovery" id="datarecovery">Data Recovery/Transfer</option>
<option value="spywareremoval" id="spywareremoval">Spyware/Adware Removal</option>
<option value="virusremoval" id="virusremoval">Virus Removal</option>
</select>
</div>
<div style="display:none" id="service-misc">
<select name="miscellaneous" id="miscellaneous" class="miscellaneous">
<option value="networksecurity" id="networksecurity">Network Security</option>
<!--<option value="webdesign" id="webdesign">Website Design</option>-->
</select>
</div><br>
Message:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Submit Request"/>
<script src="js/jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function() {
$('select').change(function(){
var boxid = $(this).children('option:selected').attr('data-target');
alert(boxid);
if(boxid == "devices") {
var divId = "service-" + boxid;
}
document.getElementById(divId).style.display = "block";
});
$("form").submit(function(){
// $(':input[value=""]').attr('disabled', true);
$("input[type='text'],select,input[type='password'],textarea",this).each(function() {
if($(this).val().trim() == "") {
$(this).attr('disabled', true);
}
})
});
});
</script>
I make four horizontal dropdown menu. Here is my code :
<div class="MenuSearching" id="Searching">
<div class="Menu1" id="Menu1">
<p> Lembaga</p>
<form style="margin-top:-20px;margin-left:-2px;">
<select name="DropLembaga" autofocus required id="DropLembaga">
<option value="no" selected="selected">---Choose one---</option>
<option value="FlashCom">FlashCom</option>
<option value="InterNusa">InterNusa</option>
<option value="HexaCompare">HexaCompare</option>
</select>
</form>
</div>
<div class="Menu2" id="Menu2">
<p> Paket Kursus</p>
<form style="margin-top:-20px;margin-left:-2px;">
<select name="DropBahasa" autofocus required id="DropBahasa">
<option value="no" selected="selected">---Choose one---</option>
<option value="web">Kursus Web Design</option>
<option value="flash">Kursus Flash Animation</option>
<option value="marketing">Kursus Internet Marketing</option>
</select>
</form>
</div>
<div class="Menu3" id="Menu3">
<p> Lokasi</p>
<form style="margin-top:-20px;margin-left:-3px;">
<select name="DropLokasi" autofocus required id="DropLokasi">
<option value="no" selected="selected">---Choose one---</option>
<option value="timur">Surabaya Timur</option>
<option value="barat">Surabaya Barat</option>
<option value="utara">Surabaya Utara</option>
<option value="selatan">Surabaya Selatan</option>
</select>
</form>
</div>
<div class="Menu4" id="Menu4">
<p> Harga</p>
<form style="margin-top:-20px;margin-left:-2px;">
<select name="DropHarga" autofocus required id="DropHarga">
<option value="no" selected="selected">---Choose one---</option>
<option value="harga1"> kurang dari Rp.750.000</option>
<option value="harga2">Rp.750.000 - Rp.1.500.000</option>
<option value="harga3">Rp.1.500.000 - Rp.2.500.000</option>
<option value="harga4">lebih dari Rp.2.500.000</option>
</select>
</form>
</div>
<div>
<input name="submitbutton" type="submit" id="submitbutton" formmethod="POST" value="search">
</div>
</div>
My question, how to make the submit button from these multiple dropdown (and get the results)?
Is my code above efficient?
Thank you for the answer!
First thing would be to change your form tags to divs to keep your formatting.
<div class="Menu1" id="Menu1">
<p> Lembaga</p>
<div style="margin-top:-20px;margin-left:-2px;">
<select name="DropLembaga" autofocus required id="DropLembaga">
<option value="no" selected="selected">---Choose one---</option>
<option value="FlashCom">FlashCom</option>
<option value="InterNusa">InterNusa</option>
<option value="HexaCompare">HexaCompare</option>
</select>
</div>
</div>
Next you will need to surround your entire form with <form></form> tags. I would place the open form tag just below the opening of your first div.
<div class="MenuSearching" id="Searching">
<form action="" method="post">
<div class="Menu1" id="Menu1">
.
.
.
</div>
<div class="Menu2" id="Menu2">
.
.
.
</div>
<div class="Menu3" id="Menu3">
.
.
.
</div>
<div class="Menu4" id="Menu4">
.
.
.
</div>
<div>
<input name="submitbutton" type="submit" id="submitbutton" formmethod="POST" value="search">
</div>
</form>
</div>
<form name="payment_info" id="payment_info" action="https://www.myvirtualmerchant.com/VirtualMerchant/process.do" method="post" >
<div class="check_form_cover">
<div class="check_form_txt fleft">Account Number:</div>
<div class="check_form_field fleft"><input name="ssl_card_number" id="ssl_card_number" type="text" class="check_form_field1" /></div>
<div class="clear"></div>
</div>
<div class="check_form_cover">
<div class="check_form_txt fleft">Expiry Date:</div>
<div class="check_form_field fleft"><select name="month" id="month" onchange="setOptions(document.payment_info.month.value);">
<option value="">Month</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
<select name="year" id="year">
<option value="">Year</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
</select>
</div>
<div class="clear"></div>
</div>
<input type="hidden" name="ssl_show_form" id="ssl_show_form" value="TRUE">
<input type="hidden" name="ssl_show_form" id="ssl_show_form" value="TRUE">
<input type="hidden" name="ssl_amount" id="ssl_amount" value="'.$total.'">
<input type="hidden" name="ssl_cvv2cvc2_indicator" id="ssl_cvv2cvc2_indicator" value="Present">
<div class="check_form_cover">
<div class="check_form_txt fleft">CVV Number:</div>
<div class="check_form_field fleft"><input name="ssl_cvv2cvc2" id="ssl_cvv2cvc2" type="text" class="check_form_field1" /></div>
<div class="clear"></div>
</div>
<div class="check_form_cover">
<div class="check_form_txt fleft"></div>
<div class="check_form_field fleft" align="right">
<input type="image" src="images/pay_now.jpg" name="payment" id="payment" value="Pay" alt="Pay">
</div>
<div class="clear"></div>
</div>
To combine the values dropdown boxes named month and year and combine them in the same form as a hidden field.
It's pretty hard to understand your question, and I'm not sure if it has any thing to do mysql.
It is combined as long as you have all the "input" under the same "form".
Hope that make sense.