Solved

Using PHP Object with SQL Query

Posted on 2014-09-13
18
130 Views
Last Modified: 2014-10-05
I've got a User form, upon submission, it consumes a web service, and the response is a contract vehicle.

This is the returned object:

stdClass Object ( [contractVehicle] => Array ( [1] => ITCommodityProgram ) )

There are several contract vehicles.

I then need to use the returned contract vehicle, query my Products table like so:

SELECT * FROM `product` WHERE `contract_vehicle` = 2


The important point is the WHERE needs to be dynamic, , not hard coded, because the returned contract vehicle will be different with each User submission.
0
Comment
Question by:sandshakimi
  • 11
  • 4
  • 2
18 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 200 total points
Comment Utility
how do you get from your returned object to the number 2 for the ID of the contract vehicle?

You will want to use php pdo to connect to the database. Something like this

$stmt = $dbh->prepare("SELECT * FROM `product` WHERE `contract_vehicle` = ?");
if ($stmt->execute(___YOUR VARIABLE GOES HERE___) {
  while ($row = $stmt->fetch()) {
    print_r($row);
  }
}

see http://php.net/manual/en/pdo.prepared-statements.php for more information
0
 

Author Comment

by:sandshakimi
Comment Utility
The database has a contract_vehicles table with unique IDs.

So for example, newyorkcom, has a contract_vehicle ID of 3, but it's in [2] in the array.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 300 total points
Comment Utility
In the contract_vehicles table, what is the column name you want to find?

Please post the CREATE TABLE statement for this table, thanks.  It may be something lie this, but we will need more specifics to give a certain answer.
<?php // demo/temp_sandshakimi.php
error_reporting(E_ALL);

// SEE http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28517944.html
// stdClass Object ( [contractVehicle] => Array ( [1] => ITCommodityProgram ) ) 
// SELECT * FROM `product` WHERE `contract_vehicle` = 2

// USE A DATA ELEMENT IN A QUERY
$cv = (string)$obj->contractVehicle[1];
$sq = "SELECT column_name FROM `product` WHERE `contract_vehicle` = '$cv' LIMIT 1";

Open in new window

0
 

Author Comment

by:sandshakimi
Comment Utility
Here is the existing Contract Vehicles table.

Contract Vehicles Table
0
 

Author Comment

by:sandshakimi
Comment Utility
Here is the web service call creating the return object.

Once it is refined, it should only return one contract vehicle. So there's only three right now.

$param = array('commodity' => 'LAPTOP',  'placeOfPerformance' => array('location' => 'LSA' , 'lsaStates' => 'NY', 'VA', 'TX', 'oconusStates' => 'ALASKA', 'EMEA'),  'equipmentType' => 'ANY', 'socioEconomicObjective' => 'NONE', 'agencyCode' => '007',);

$client = new SoapClient('https://sso-test.fas.gsa.gov/mpdev/navigator/wsdl');  
$results = $client->__soapCall('retrieveContractVehicles', array('parameters' => $param));  
  
print_r($results);

Open in new window

0
 

Author Comment

by:sandshakimi
Comment Utility
Forgot to mention in the last post, for prototyp purposes I obviously, hard coded the values.

But on production it will be a user form.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
I'm confused.  The SOAP call returns data that looks like ITCommodityProgram but there is nothing that matches that in the contract vehicles table.
0
 

Author Comment

by:sandshakimi
Comment Utility
Ray, you're right. I'm told the ITCommodityProgram will be the next record, perhaps I'm guessing contract_vehicle_id of 4, and vehicle_name of IT Commodity.

I'm developing out the PHP faster then the team on the db is doing their stuff.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:sandshakimi
Comment Utility
Also, I'm told that it is legitimate to have more than one Contract Vehicle. So in the above SOAP call prototype, I'm returning two.

But on the form, it may return nothing, one or all four.
0
 
LVL 24

Expert Comment

by:mankowitz
Comment Utility
I think we can help you much more if you can provide an example of the objects that are returned. For example, in you question you gave a field that is probably the vehicle_name, not the ID.

You know what they say, walking on water and writing to a specification is easy, as long as they are frozen.
0
 

Author Comment

by:sandshakimi
Comment Utility
This form has the SOAP call in it. If run, you will get the Object back.
0
 

Author Comment

by:sandshakimi
Comment Utility
Revised. The final form.

<!DOCTYPE html>
<html>


<link rel="stylesheet" href="sites/all/scripts/bootstrap-3.1.1.min.css" type="text/css"/>
<script type="text/javascript" src="sites/all/scripts/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="sites/all/scripts/bootstrap-3.1.1.min.js"></script>


<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

<script type="text/javascript" src="bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="bootstrap-multiselect.css" type="text/css"/>


<!-- START FORM -->
<!-- Post the values to SOAP request -->
<body>

<br />
<b>Notice</b>:  Undefined index: commodity in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>24</b><br />
<br />
<b>Notice</b>:  Undefined index: location in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>25</b><br />
<br />
<b>Notice</b>:  Undefined index: lsaStates in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>26</b><br />
<br />
<b>Notice</b>:  Undefined index: oconusStates in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>27</b><br />
<br />
<b>Notice</b>:  Undefined index: equipmentType in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>28</b><br />
<br />
<b>Notice</b>:  Undefined index: socioEconomicObjective in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>29</b><br />
<br />
<b>Notice</b>:  Undefined index: agencyCode in <b>C:\apache\htdocs\process-form\process-form.php</b> on line <b>30</b><br />

<form method="post" action="">

<div class="col-xs-12" style="border:solid 0px #666; padding:8px; margin-bottom:20px; border-radius: 10px;">
         <div class="col-xs-12 col-md-8">
        <div class="row">
          <div class="row"><div class="col-sm-6"><ul class="list-group">
            <li class="list-group-item"><strong>Location</strong></li>
            <li class="list-group-item">
			
			<!-- Pass the commodity: Laptop -->
			<input name="commodity" id="commodity" type="hidden" value="LAPTOP" />
			
			<!-- Pass the agency: 006 -->
			<input name="agencyCode" id="agencyCode" type="hidden" value="006" />
			
			<!-- Capture the Location: Conus -->
            <input name="location" id="location" type="radio" checked="checked" value="CONUS">CONUS</li>
			
            <li class="list-group-item">Local Service Areas. Select all that apply from 48 States and the District of Columbia:<br>
            
			<!-- Capture the Location: LSA -->
			<input name="location" id="lsa" type="radio" value="LSA">Local Service Areas<br />
			
			<!-- Capture the LSA States -->
			<div style="border:2px solid #ccc; width:350px; height: 90px; overflow-y: scroll;">
			<input type="checkbox" name="lsaStates" value="AL" />Alabama <br />
			<input type="checkbox" name="lsaStates" value="AZ" />Arizona <br />
			<input type="checkbox" name="lsaStates" value="AR" />Arkansas <br />
			<input type="checkbox" name="lsaStates" value="CA" />California <br />
			<input type="checkbox" name="lsaStates" value="CO" />Colorado <br />
			<input type="checkbox" name="lsaStates" value="CT" />Connecticut <br />
			<input type="checkbox" name="lsaStates" value="DC" />DC (including MD and VA areas in Metro DC) <br />
			<input type="checkbox" name="lsaStates" value="DE" />Delaware <br />
			<input type="checkbox" name="lsaStates" value="FL" />Florida <br />
			<input type="checkbox" name="lsaStates" value="GA" />Georgia <br />
			<input type="checkbox" name="lsaStates" value="ID" />Idaho <br />
			<input type="checkbox" name="lsaStates" value="IL" />Illinois <br />
			<input type="checkbox" name="lsaStates" value="IN" />Indiana <br />
			<input type="checkbox" name="lsaStates" value="IA" />Iowa <br />
			<input type="checkbox" name="lsaStates" value="KS" />Kansas <br />
			<input type="checkbox" name="lsaStates" value="KY" />Kentucky <br />
			<input type="checkbox" name="lsaStates" value="LA" />Louisiana <br />
			<input type="checkbox" name="lsaStates" value="ME" />Maine <br />
			<input type="checkbox" name="lsaStates" value="MD" />Maryland <br />
			<input type="checkbox" name="lsaStates" value="MA" />Massachusetts <br />
			<input type="checkbox" name="lsaStates" value="MI" />Michigan <br />
			<input type="checkbox" name="lsaStates" value="MN" />Minnesota <br />
			<input type="checkbox" name="lsaStates" value="MS" />Mississippi <br />
			<input type="checkbox" name="lsaStates" value="MO" />Missouri <br />
			<input type="checkbox" name="lsaStates" value="MT" />Montana <br />
			<input type="checkbox" name="lsaStates" value="NE" />Nebraska <br />
			<input type="checkbox" name="lsaStates" value="NV" />Nevada <br />
			<input type="checkbox" name="lsaStates" value="NH" />New Hampshire <br />
			<input type="checkbox" name="lsaStates" value="NJ" />New Jersey <br />
			<input type="checkbox" name="lsaStates" value="NM" />New Mexico <br />
			<input type="checkbox" name="lsaStates" value="NY" />New York <br />
			<input type="checkbox" name="lsaStates" value="NC" />North Carolina <br />
			<input type="checkbox" name="lsaStates" value="ND" />North Dakota <br />
			<input type="checkbox" name="lsaStates" value="OH" />Ohio <br />
			<input type="checkbox" name="lsaStates" value="OK" />Oklahoma <br />
			<input type="checkbox" name="lsaStates" value="OR" />Oregon <br />
			<input type="checkbox" name="lsaStates" value="PA" />Pennsylvania <br />
			<input type="checkbox" name="lsaStates" value="RI" />Rhode Island <br />
			<input type="checkbox" name="lsaStates" value="SC" />South Carolina <br />
			<input type="checkbox" name="lsaStates" value="SD" />South Dakota <br />
			<input type="checkbox" name="lsaStates" value="TN" />Tennessee <br />
			<input type="checkbox" name="lsaStates" value="TX" />Texas <br />
			<input type="checkbox" name="lsaStates" value="UT" />Utah <br />
			<input type="checkbox" name="lsaStates" value="VT" />Vermont <br />
			<input type="checkbox" name="lsaStates" value="VA" />Virginia <br />
			<input type="checkbox" name="lsaStates" value="WA" />Washington <br />
			<input type="checkbox" name="lsaStates" value="WV" />West Virginia <br />
			<input type="checkbox" name="lsaStates" value="WI" />Wisconsin <br />
			<input type="checkbox" name="lsaStates" value="WY" />Wyoming
			</div>
			  
			 </li>
            
			<li class="list-group-item">Specific Outside of Continental United States (OCONUS). Select all that apply:<br>
			<!-- Pass value of Oconus area -->
			<input type="checkbox" name="oconusStates" value="ALASKA" />Alaska and Arctic Region <br />
			<input type="checkbox" name="oconusStates" value="CARIBBEAN" />Caribbean (Puerto Rico and US Virgin Islands) <br />
			<input type="checkbox" name="oconusStates" value="EMEA" />Europe, Africa and Middle East <br />
			<input type="checkbox" name="oconusStates" value="HAWAII" />Hawaii and Pacific Rim <br />

            <li class="list-group-item">
			
            <!-- Pass the Location: Global -->
			<input name="location" id="global" type="radio" value="GLOBAL">Global</li>
			
			<!-- Pass the socio economic indicators -->
			</ul></div>
			<div class="col-sm-6"><ul class="list-group">
            <li class="list-group-item"><strong>Socio Economic Indicators</strong></li>
			
            <li class="list-group-item">
			<label for=""  style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" value="SB" id="SB" data-ptag="sb1" class="check_box"></code>&nbsp;Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="womenBus" value="WOB" data-ptag="sb2" class="check_box"></code>&nbsp;Women Owned Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="womOSB" value="WOSB" data-ptag="sb3" class="check_box"></code>&nbsp;Women Owned Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="Eco_DWOSB" value="EDWOSB" data-ptag="sb4" class="check_box"></code>&nbsp;Economically Disadvantaged Women Owned Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="VetOSB" value="VOSB" data-ptag="sb5" class="check_box"></code>&nbsp;Veteran Owned Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="SerDVOSB" value="SDVOSB" data-ptag="sb6" class="check_box"></code>&nbsp;Service Disabled Veteran Owned Small Business</li></label>
			
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" id="SBA_Certified" value="SBACSDB" data-ptag="sb7" class="check_box"></code>&nbsp;SBA Certified Small Disadvantaged Business</li></label>
		   
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" id="SBA_8" value="SBA8ACB" data-ptag="sb8" class="check_box"></code>&nbsp;SBA 8(a) Certified Business</li></label>
		   
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" value="SBCHSB" id="SBA_Cert" data-ptag="sb9" class="check_box"></code>&nbsp;SBA Certified HUBZone Small Business</li></label>
		   
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" value="NOPREFERENCE" id="NoPref" data-ptag="sb10" class="check_box"></code>&nbsp;No Preference</li></label>
            
			<!-- Pass value of equipmentype -->
			<p><strong>Equipment Type</strong></p>
			<input type="checkbox" name="equipmentType" value="NEW" />New Laptop <br />
			<input type="checkbox" name="equipmentType" value="REFURBISHED" />Refurbished Laptop <br />
			<input type="checkbox" name="equipmentType" value="ANY" />Any Laptop <br />

          </ul></div>
        
          </div>
		  <!-- Submit the form, for now just display the results on the screen -->
		  <p><input class="btn btn-sm btn-success" type="submit" name="submit" value="Update Pricing"></p>
		  </div>
		  </div>
          <div class="col-xs-6 col-md-4">
         
           <div class="well">
           <h3><strong>Advice & Definitions</strong></h3>
                         <p id="sb1" class="p_element">Small Business - Privately owned corporations, Partnerships. or sole proprietrorships.  </p>
            <p id="sb2" class="p_element">Women Owned Business - Business which is majority owned by one or more female American citizens.  </p>
            <p id="sb3" class="p_element">Women Owned Small Business - Small Business which is majority owned by one or more female American citizens.  </p>
            <p id="sb4" class="p_element">Economically Disadvantage Women Owned Small Business - Small Business which is majority owned by one or more female American citizens who are economically disadvantaged.  </p>
            <p id="sb5" class="p_element">Veteran Owned Small Business - Small Business which is majority owned by one or more veterans.  </p>
            <p id="sb6" class="p_element">Service Disabled Veteran Owned Small Business - Small Business which is majority owned by one or more service disabled veterans.  </p>
            <p id="sb7" class="p_element">SBA Certified Small Disadvantaged Business - Government certified Small Business which is majority owned by disadvantaged persons.  </p>
            <p id="sb8" class="p_element">SBA 8 (a) Certified Business - Government certified Small Business which is majority owned by socially and economically disadvantaged individuals who are American citizens.   </p>
            <p id="sb9" class="p_element">SBA Certified HUBZONE Small Business - Government certified Small Business which is majority owned by disadvantaged persons in urban and rural communities .  </p>
            <p id="sb10" class="p_element">No Preference -  No preference on socio economic.  </p>
           
          </div>
          </div>  
		  </form><!-- END OF PROCESS FORM -->

<!-- Initialize the plugin: -->
<script type="text/javascript">
$(document).ready(function() 
{
    $('.multiselect').multiselect
    ({
        maxHeight: 300
    });

});

$(document).ready(function() 
{
    $("#conusid").click(function(){
        $("#localserviceid").attr('checked',false);
        $("#worldid").attr('checked',false);
    });
  $("#localserviceid").click(function(){ 
      $("#conusid").attr('checked',false);
  });
       $("#worldid").click(function(){ 
      $("#conusid").attr('checked',false);
  });

   $("#stand , #stand1").click(function()
   { 
      $("#lap_spec").show(1000);
      $("#lite_wt").hide(1000);
      $("#perormance_spec").hide(1000);
   });
  
  
   $("#ltwt, #ltwt1").click(function()
   { 
      $("#lap_spec").hide(1000);
      $("#lite_wt").show(1000);
      $("#perormance_spec").hide(1000);
   });
   
   
    $("#perform, #perform1").click(function()
   { 
      $("#lap_spec").hide(1000);
      $("#lite_wt").hide(1000);
      $("#perormance_spec").show(1000);
   });


}); 
</script>

<code style="background: none;">
 <script>
$('.check_box').change(function()
{
    if($('.check_box:checked').length==0)
    {
        $('.p_element').show();
    }
    else
    {
    $('.p_element').hide();
        $('.check_box:checked').each(function()
        {
            $('#'+$(this).attr('data-ptag')).show();
        });
    }

});
</script>
</code>


 
 </body>
 </html>

Open in new window

0
 

Author Comment

by:sandshakimi
Comment Utility
Sorry, I goofed again.

Here's the PHP form.

<link rel="stylesheet" href="sites/all/scripts/bootstrap-3.1.1.min.css" type="text/css"/>
<script type="text/javascript" src="sites/all/scripts/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="sites/all/scripts/bootstrap-3.1.1.min.js"></script>
<script type="text/javascript" src="sites/all/scripts/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="sites/all/scripts/bootstrap-multiselect.css" type="text/css"/>


<!-- START FORM -->
<!-- Post the values to SOAP request on soapcall.php -->
<?php
// Define the location of the WSDL, and create an instance of the SoapClient class to access the web service -->
$client = new SoapClient('https://sso-test.fas.gsa.gov/mpdev/navigator/wsdl');  
$commodity = $_POST['commodity'];
$location = $_POST['location'];
$lsaStates = $_POST['lsaStates'];
$oconusStates = $_POST['oconusStates'];
$equipmentType = $_POST['equipmentType'];
$socioEconomicObjective = $_POST['socioEconomicObjective'];
$agencyCode = $_POST['agencyCode'];

// If empty, pass Null
if (!empty($_POST['commodity'])) {
   $commodity = $_POST['commodity'];
} else {
   $commodity = null;
}

if (!empty($_POST['location'])) {
   $location = $_POST['location'];
} else {
   $location = null;
}

if (!empty($_POST['lsaStates'])) {
   $lsaStates = $_POST['lsaStates'];
} else {
   $lsaStates = null;
}

if (!empty($_POST['oconusStates'])) {
   $oconusStates = $_POST['oconusStates'];
} else {
   $oconusStates = null;
}

if (!empty($_POST['equipmentType'])) {
   $equipmentType = $_POST['equipmentType'];
} else {
   $equipmentType = null;
}

if (!empty($_POST['socioEconomicObjective'])) {
   $socioEconomicObjective = $_POST['socioEconomicObjective'];
} else {
   $socioEconomicObjective = null;
}

if (!empty($_POST['agencyCode'])) {
   $agencyCode = $_POST['agencyCode'];
} else {
   $agencyCode = null;
}

// Sent the parameters through the SOAP client
$param = array(
'commodity' => $commodity,
'placeOfPerformance' => array('location' => $location , 'lsaStates' => $lsaStates, 'oconusStates' => $oconusStates),
'equipmentType' => $equipmentType,
'socioEconomicObjective' => $socioEconomicObjective,
'agencyCode' => $agencyCode,
);

// Return results
$resultsProcess = $client->__soapCall('retrieveContractVehicles', array('parameters' => $param));  
?>

<form method="post" action="">

<div class="col-xs-12" style="border:solid 0px #666; padding:8px; margin-bottom:20px; border-radius: 10px;">
         <div class="col-xs-12 col-md-8">
        <div class="row">
          <div class="row"><div class="col-sm-6"><ul class="list-group">
            <li class="list-group-item"><strong>Location</strong></li>
            <li class="list-group-item">
			
			<!-- Pass the commodity: Laptop -->
			<input name="commodity" id="commodity" type="hidden" value="LAPTOP" />
			
			<!-- Pass the agency: 006 -->
			<input name="agencyCode" id="agencyCode" type="hidden" value="006" />
			
			<!-- Capture the Location: Conus -->
            <input name="location" id="location" type="radio" checked="checked" value="CONUS">CONUS</li>
			
            <li class="list-group-item">Local Service Areas. Select all that apply from 48 States and the District of Columbia:<br>
            
			<!-- Capture the Location: LSA -->
			<input name="location" id="lsa" type="radio" value="LSA">Local Service Areas<br />
			
			<!-- Capture the LSA States -->
			<div style="border:2px solid #ccc; width:350px; height: 90px; overflow-y: scroll;">
			<input type="checkbox" name="lsaStates" value="AL" />Alabama <br />
			<input type="checkbox" name="lsaStates" value="AZ" />Arizona <br />
			<input type="checkbox" name="lsaStates" value="AR" />Arkansas <br />
			<input type="checkbox" name="lsaStates" value="CA" />California <br />
			<input type="checkbox" name="lsaStates" value="CO" />Colorado <br />
			<input type="checkbox" name="lsaStates" value="CT" />Connecticut <br />
			<input type="checkbox" name="lsaStates" value="DC" />DC (including MD and VA areas in Metro DC) <br />
			<input type="checkbox" name="lsaStates" value="DE" />Delaware <br />
			<input type="checkbox" name="lsaStates" value="FL" />Florida <br />
			<input type="checkbox" name="lsaStates" value="GA" />Georgia <br />
			<input type="checkbox" name="lsaStates" value="ID" />Idaho <br />
			<input type="checkbox" name="lsaStates" value="IL" />Illinois <br />
			<input type="checkbox" name="lsaStates" value="IN" />Indiana <br />
			<input type="checkbox" name="lsaStates" value="IA" />Iowa <br />
			<input type="checkbox" name="lsaStates" value="KS" />Kansas <br />
			<input type="checkbox" name="lsaStates" value="KY" />Kentucky <br />
			<input type="checkbox" name="lsaStates" value="LA" />Louisiana <br />
			<input type="checkbox" name="lsaStates" value="ME" />Maine <br />
			<input type="checkbox" name="lsaStates" value="MD" />Maryland <br />
			<input type="checkbox" name="lsaStates" value="MA" />Massachusetts <br />
			<input type="checkbox" name="lsaStates" value="MI" />Michigan <br />
			<input type="checkbox" name="lsaStates" value="MN" />Minnesota <br />
			<input type="checkbox" name="lsaStates" value="MS" />Mississippi <br />
			<input type="checkbox" name="lsaStates" value="MO" />Missouri <br />
			<input type="checkbox" name="lsaStates" value="MT" />Montana <br />
			<input type="checkbox" name="lsaStates" value="NE" />Nebraska <br />
			<input type="checkbox" name="lsaStates" value="NV" />Nevada <br />
			<input type="checkbox" name="lsaStates" value="NH" />New Hampshire <br />
			<input type="checkbox" name="lsaStates" value="NJ" />New Jersey <br />
			<input type="checkbox" name="lsaStates" value="NM" />New Mexico <br />
			<input type="checkbox" name="lsaStates" value="NY" />New York <br />
			<input type="checkbox" name="lsaStates" value="NC" />North Carolina <br />
			<input type="checkbox" name="lsaStates" value="ND" />North Dakota <br />
			<input type="checkbox" name="lsaStates" value="OH" />Ohio <br />
			<input type="checkbox" name="lsaStates" value="OK" />Oklahoma <br />
			<input type="checkbox" name="lsaStates" value="OR" />Oregon <br />
			<input type="checkbox" name="lsaStates" value="PA" />Pennsylvania <br />
			<input type="checkbox" name="lsaStates" value="RI" />Rhode Island <br />
			<input type="checkbox" name="lsaStates" value="SC" />South Carolina <br />
			<input type="checkbox" name="lsaStates" value="SD" />South Dakota <br />
			<input type="checkbox" name="lsaStates" value="TN" />Tennessee <br />
			<input type="checkbox" name="lsaStates" value="TX" />Texas <br />
			<input type="checkbox" name="lsaStates" value="UT" />Utah <br />
			<input type="checkbox" name="lsaStates" value="VT" />Vermont <br />
			<input type="checkbox" name="lsaStates" value="VA" />Virginia <br />
			<input type="checkbox" name="lsaStates" value="WA" />Washington <br />
			<input type="checkbox" name="lsaStates" value="WV" />West Virginia <br />
			<input type="checkbox" name="lsaStates" value="WI" />Wisconsin <br />
			<input type="checkbox" name="lsaStates" value="WY" />Wyoming
			</div>
			  
			 </li>
            
			<li class="list-group-item">Specific Outside of Continental United States (OCONUS). Select all that apply:<br>
			<!-- Pass value of Oconus area -->
			<input type="checkbox" name="oconusStates" value="ALASKA" />Alaska and Arctic Region <br />
			<input type="checkbox" name="oconusStates" value="CARIBBEAN" />Caribbean (Puerto Rico and US Virgin Islands) <br />
			<input type="checkbox" name="oconusStates" value="EMEA" />Europe, Africa and Middle East <br />
			<input type="checkbox" name="oconusStates" value="HAWAII" />Hawaii and Pacific Rim <br />

            <li class="list-group-item">
			
            <!-- Pass the Location: Global -->
			<input name="location" id="global" type="radio" value="GLOBAL">Global</li>
			
			<!-- Pass the socio economic indicators -->
			</ul></div>
			<div class="col-sm-6"><ul class="list-group">
            <li class="list-group-item"><strong>Socio Economic Indicators</strong></li>
			
            <li class="list-group-item">
			<label for=""  style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" value="SB" id="SB" data-ptag="sb1" class="check_box"></code>&nbsp;Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="womenBus" value="WOB" data-ptag="sb2" class="check_box"></code>&nbsp;Women Owned Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="womOSB" value="WOSB" data-ptag="sb3" class="check_box"></code>&nbsp;Women Owned Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="Eco_DWOSB" value="EDWOSB" data-ptag="sb4" class="check_box"></code>&nbsp;Economically Disadvantaged Women Owned Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="VetOSB" value="VOSB" data-ptag="sb5" class="check_box"></code>&nbsp;Veteran Owned Small Business</li></label>
			
            <li class="list-group-item">
			<label for="checkbox" style="font-weight:normal">
			<code style="background: none;">
			<input name="socioEconomicObjective" type="checkbox" id="SerDVOSB" value="SDVOSB" data-ptag="sb6" class="check_box"></code>&nbsp;Service Disabled Veteran Owned Small Business</li></label>
			
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" id="SBA_Certified" value="SBACSDB" data-ptag="sb7" class="check_box"></code>&nbsp;SBA Certified Small Disadvantaged Business</li></label>
		   
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" id="SBA_8" value="SBA8ACB" data-ptag="sb8" class="check_box"></code>&nbsp;SBA 8(a) Certified Business</li></label>
		   
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" value="SBCHSB" id="SBA_Cert" data-ptag="sb9" class="check_box"></code>&nbsp;SBA Certified HUBZone Small Business</li></label>
		   
           <li class="list-group-item">
		   <label for="checkbox" style="font-weight:normal">
		   <code style="background: none;">
		   <input name="socioEconomicObjective" type="checkbox" value="NOPREFERENCE" id="NoPref" data-ptag="sb10" class="check_box"></code>&nbsp;No Preference</li></label>
            
			<!-- Pass value of equipmentype -->
			<p><strong>Equipment Type</strong></p>
			<input type="checkbox" name="equipmentType" value="NEW" />New Laptop <br />
			<input type="checkbox" name="equipmentType" value="REFURBISHED" />Refurbished Laptop <br />
			<input type="checkbox" name="equipmentType" value="ANY" />Any Laptop <br />

          </ul></div>
        
          </div>
		  <!-- Submit the form, for now just display the results on the screen -->
		  <p><input class="btn btn-sm btn-success" type="submit" name="submit" value="Update Pricing"></p>
		  </div>
		  </div>
          <div class="col-xs-6 col-md-4">
         
           <div class="well">
           <h3><strong>Advice & Definitions</strong></h3>
                         <p id="sb1" class="p_element">Small Business - Privately owned corporations, Partnerships. or sole proprietrorships.  </p>
            <p id="sb2" class="p_element">Women Owned Business - Business which is majority owned by one or more female American citizens.  </p>
            <p id="sb3" class="p_element">Women Owned Small Business - Small Business which is majority owned by one or more female American citizens.  </p>
            <p id="sb4" class="p_element">Economically Disadvantage Women Owned Small Business - Small Business which is majority owned by one or more female American citizens who are economically disadvantaged.  </p>
            <p id="sb5" class="p_element">Veteran Owned Small Business - Small Business which is majority owned by one or more veterans.  </p>
            <p id="sb6" class="p_element">Service Disabled Veteran Owned Small Business - Small Business which is majority owned by one or more service disabled veterans.  </p>
            <p id="sb7" class="p_element">SBA Certified Small Disadvantaged Business - Government certified Small Business which is majority owned by disadvantaged persons.  </p>
            <p id="sb8" class="p_element">SBA 8 (a) Certified Business - Government certified Small Business which is majority owned by socially and economically disadvantaged individuals who are American citizens.   </p>
            <p id="sb9" class="p_element">SBA Certified HUBZONE Small Business - Government certified Small Business which is majority owned by disadvantaged persons in urban and rural communities .  </p>
            <p id="sb10" class="p_element">No Preference -  No preference on socio economic.  </p>
           
          </div>
          </div>  
		  </form><!-- END OF PROCESS FORM -->

<div style="border: 1px solid #000; width: 600px;">
		  <?php
		  print_r($resultsProcess);  
		  echo "<p>Contract Vehicles:</p>"; 

		  ?>
</div>

<!-- Initialize the plugin: -->
<script type="text/javascript">
$(document).ready(function() 
{
    $('.multiselect').multiselect
    ({
        maxHeight: 300
    });

});

$(document).ready(function() 
{
    $("#conusid").click(function(){
        $("#localserviceid").attr('checked',false);
        $("#worldid").attr('checked',false);
    });
  $("#localserviceid").click(function(){ 
      $("#conusid").attr('checked',false);
  });
       $("#worldid").click(function(){ 
      $("#conusid").attr('checked',false);
  });

   $("#stand , #stand1").click(function()
   { 
      $("#lap_spec").show(1000);
      $("#lite_wt").hide(1000);
      $("#perormance_spec").hide(1000);
   });
  
  
   $("#ltwt, #ltwt1").click(function()
   { 
      $("#lap_spec").hide(1000);
      $("#lite_wt").show(1000);
      $("#perormance_spec").hide(1000);
   });
   
   
    $("#perform, #perform1").click(function()
   { 
      $("#lap_spec").hide(1000);
      $("#lite_wt").hide(1000);
      $("#perormance_spec").show(1000);
   });


}); 
</script>

<code style="background: none;">
 <script>
$('.check_box').change(function()
{
    if($('.check_box:checked').length==0)
    {
        $('.p_element').show();
    }
    else
    {
    $('.p_element').hide();
        $('.check_box:checked').each(function()
        {
            $('#'+$(this).attr('data-ptag')).show();
        });
    }

});
</script>
</code>
 

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Is that supposed to be working code?  It looks like the action script for a POST-method request, but without the POSTed data, it doesn't seem to work correctly.
http://iconoun.com/demo/temp_sandshakimi.php
0
 

Author Comment

by:sandshakimi
Comment Utility
Well, the intent of my form was simply to get back the Object.

I figured once I have that, I can use it with a SQL query like so:

$qry = SELECT * FROM contract_vehicle  WHERE vehicle_name = $somevariable?

Didn't think that far, so I should be POSTing this to a new file, run-sql.php to run the above SQL?

I will still need to understand how to pass the selected contract vehicle.
0
 

Author Comment

by:sandshakimi
Comment Utility
The form does return an Object, and it works on your link also.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
I've deleted the copy of the script on my server since it was filling up the error logs every time someone used it.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Creating and Managing Databases with phpMyAdmin in cPanel.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now