Page 1 of 1

Passing Multiple Values from a Single Field

Posted: Thu Oct 07, 2004 8:35 am
by LaRosa
hello,

i'm a programmer/web designer for a company and i've just taken over someone's project and i'm having some problems getting the form to work properly.

the site right now has 2 drop down menus that work just fine as seen in the link below:
http://www.dialysissearch.com/jobs/search.php

but here's what i'm trying to do (cuz this is what the site owner wants):
http://www.dialysissearch.com/secondDraft/jobs/search.php

but i'm having problems passing the multiple variables and then calling those back to pull the data from the MySQL database... any help would be great. below is the code I'm using.

Code for the front Search page (search.php)

Code: Select all

<?php

    include_once('./manager/dbinit.inc');
	$stateTemp = "";
    $category = "<select name='cid[]' multiple size=4>"
        ."<option value=''>- - -Any Category- - - -</option>";
        
    $select = "SELECT ID, Name FROM Categories";
	
	$result = mysql_query($select)
        or die_gracefully(mysql_error(),'Could not lookup job categories.');
    while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
        $catid = $row['ID'];
        $cname = $row['Name'];
        $category .= "<option value='{$catid}'>{$cname}</option>\n";
    }
    $category .= "</select>";
    mysql_free_result($result);	
#start of code to fill states dropdown menu----------------------------------------
$stateLocation = "<select name='stateId[]' multiple size=4>"."<option value=''>- - - Any State - - -</option>";       
    $select = "SELECT ID, JobLocation FROM Jobs ORDER BY JobLocation ASC";
    $result = mysql_query($select)
        or die_gracefully(mysql_error(),'Could not lookup job''s location.');
    while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
        $stateId = $row['ID'];
        $stateName = $row['JobLocation'];
  
  if ($stateTemp != $stateName)
  {
        	$stateLocation .= "<option value='$stateName'>$stateName</option>\n";
  }
  
  $stateTemp = $row['JobLocation'];
    }
    $stateLocation .= "</select>";
    mysql_free_result($result);

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Dialysis Search Incorporated - Mission and Values</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	margin-left: 0px;
	margin-right: 0px;
	margin-top: 0px;
	margin-bottom: 0px;
	
}
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style2 {
	color: #666666;
	background-repeat: repeat-x;
}
body {
	background-color: #FFFFFF;
}
.style3 {font-size: 12px}
a:link {
	color: #005594;
	text-decoration: none;
}
a:visited {
	color: #005594;
	text-decoration: none;
}
a:hover {
	color: #333333;
	text-decoration: underline;
}
a:active {
	color: #333333;
	text-decoration: none;
}
-->
</style>
<script language="JavaScript">
<!--
function mmLoadMenus() {
  if (window.mm_menu_0527182705_0) return;
                                      window.mm_menu_0527182705_0 = new Menu("root",140,17,"Verdana, Arial, Helvetica, sans-serif",11,"#CCCCCC","#005594","#005594","#CCCCCC","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0527182705_0.addMenuItem("Mission&nbsp;and&nbsp;Values","location='../content/content/mission.html'");
  mm_menu_0527182705_0.addMenuItem("Company&nbsp;History","location='../content/content/history.html'");
  mm_menu_0527182705_0.addMenuItem("Our&nbsp;Team","location='../content/content/team.html'");
   mm_menu_0527182705_0.hideOnMouseOut=true;
   mm_menu_0527182705_0.bgColor='#555555';
   mm_menu_0527182705_0.menuBorder=1;
   mm_menu_0527182705_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0527182705_0.menuBorderBgColor='#FFFFFF';
window.mm_menu_0527184307_0 = new Menu("root",197,17,"Verdana, Arial, Helvetica, sans-serif",11,"#CCCCCC","#005594","#005594","#CCCCCC","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0527184307_0.addMenuItem("Overview","location='../content/content/candidateOverview.html'");
  mm_menu_0527184307_0.addMenuItem("Job&nbsp;Opportunities","location='../content/content/jobOpportunities.html'");
  mm_menu_0527184307_0.addMenuItem("Submit&nbsp;Resume","location='../content/content/submitResume.html'");
  mm_menu_0527184307_0.addMenuItem("Ensuring&nbsp;a&nbsp;Successful&nbsp;Search","location='../content/content/successfulSearch.html'");
  mm_menu_0527184307_0.addMenuItem("Relocation&nbsp;Tools","location='../content/content/relocationTools.html'");
  mm_menu_0527184307_0.addMenuItem("Career&nbsp;Resources","location='../content/content/careerResources.html'");
  mm_menu_0527184307_0.addMenuItem("Testimonials","location='../content/content/candidateTestimonials.html'");
   mm_menu_0527184307_0.hideOnMouseOut=true;
   mm_menu_0527184307_0.bgColor='#555555';
   mm_menu_0527184307_0.menuBorder=1;
   mm_menu_0527184307_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0527184307_0.menuBorderBgColor='#FFFFFF';
  window.mm_menu_0527184308_0 = new Menu("root",197,17,"Verdana, Arial, Helvetica, sans-serif",11,"#CCCCCC","#005594","#005594","#CCCCCC","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0527184308_0.addMenuItem("Overview","location='../content/content/clientOverview.html'");
  mm_menu_0527184308_0.addMenuItem("Featured&nbsp;Candidates","location='../content/content/featuredCandidates.html'");
  mm_menu_0527184308_0.addMenuItem("Submit&nbsp;Job&nbsp;Order","location='../content/content/submitJobOrder.html'");
  mm_menu_0527184308_0.addMenuItem("Ensuring&nbsp;a&nbsp;Successful&nbsp;Search","location='../content/content/successfulSearch.html'");
  mm_menu_0527184308_0.addMenuItem("Staffing&nbsp;Resources","location='../content/content/staffingResources.html'");
  mm_menu_0527184308_0.addMenuItem("Testimonials","location='../content/content/clientTestimonials.html'");
   mm_menu_0527184308_0.hideOnMouseOut=true;
   mm_menu_0527184308_0.bgColor='#555555';
   mm_menu_0527184308_0.menuBorder=1;
   mm_menu_0527184308_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0527184308_0.menuBorderBgColor='#FFFFFF';
mm_menu_0527184307_0.writeMenus();
mm_menu_0527184308_0.writeMenus();
} // mmLoadMenus()
//-->
</script>
<script language="JavaScript" src="../mm_menu.js"></script>
</head>

<body>
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="25%" style="">&nbsp;</td>
    <td width="742"><table width="742" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="742" height="144">
            <param name="movie" value="../content/flas/jobOpportunities.swf">
            <param name="quality" value="high">
            <embed src="../content/flas/jobOpportunities.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="742" height="144"></embed>
          </object></td>
        </tr>
        <tr>
          <td colspan="4"><img src="../images/jobOpportunities/middleBanner.jpg" name="image1" width="742" height="81" border="0" usemap="#Map" id="image1"></td>
        </tr>
        <tr>
          <td width="12" valign="top"><p>&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p></td>
          <td width="488" valign="top"><p align="justify"><span class="style1"><br>
                <img src="../images/jobOpportunities/quote.jpg" width="472" height="60"></span></p>
            <form action="list.php" method="post">
<table border="0" cellpadding="4" cellspacing="2" width="400">
    <tr>
        <td>By Job Category:</td>
        <td><?=$category?></td>
    </tr>
    <!--<tr>
        <td>Containing Text:</td>
        <td><input type='text' name='qid' value='' /></td>
    </tr>
    <tr>-->
        <td height="26">By State: </td>
        <td><?=$stateLocation?></td>
    </tr>
    <tr>
      <td height="45"></td>
      <td><button type='submit'>Search</button></td>
    </tr>
</table>
<p>&nbsp;</p>
            </form>
            <p align="center"><strong>or click a portion of the map below to search by region<br>
                <img src="../images/candidateCenter/jobs/USmap.gif" width="480" height="300" border="0" usemap="#Map3"></strong>
              <map name="Map3" id="Map3">
                <area shape="poly" coords="176,27" href="#">
                <area shape="poly" coords="186,37,51,13,32,16,25,59,19,82,12,101,21,148,17,218,12,260,38,278,115,277,178,288,142,220,180,220,184,164,193,163,197,127,176,124" href="list.php?gid=3" alt="Western States">
                <area shape="poly" coords="148,223,173,254,187,243,203,264,213,284,227,288,227,275,236,264,254,251,270,247,280,249,292,252,304,247,301,239,301,234,285,232,289,221,287,204,305,167,314,146,310,108,308,85,308,75,290,68,281,64,272,63,288,49,251,40,234,40,188,38,180,119,199,123,197,169,187,167,182,225" href="list.php?gid=2" alt="Central States">
                <area shape="poly" coords="291,64,311,74,316,117,317,149,292,205,293,220,290,230,305,230,307,241,336,237,350,243,361,238,375,250,378,262,397,286,403,272,382,228,385,210,401,191,419,172,424,168,412,146,398,131,374,129,372,107,355,117,349,105,354,96,349,88,342,92,342,83,344,74,335,67,325,61,306,59,302,55" href="list.php?gid=1" alt="Eastern States">
                <area shape="poly" coords="374,102,377,122,400,125,411,136,420,138,427,116,430,98,450,89,447,71,466,47,454,26,443,31,444,44,439,54,409,63,401,74,404,80,392,86,382,87" href="list.php?gid=0" alt="Northeastern States">
                <area shape="poly" coords="133,227" href="#">
              </map>
            </p>
              <p align="left"><strong></strong></p>
              <p><strong></strong></p>              <p align="justify" class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p></td>
          <td width="15" valign="top">&nbsp;</td>
          <td width="227" valign="top" background="../images/slices/rightBannerBG.jpg"><img src="../images/jobOpportunities/rightBanner.jpg" width="227" height="496"></td>
        </tr>
    </table></td>
    <td width="25%" style="";>&nbsp;</td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="2,0,88,26" onMouseOver="MM_showMenu(window.mm_menu_0527182705_0,20,27,null,'image1')" onMouseOut="MM_startTimeout();">
  <area shape="rect" coords="94,2,219,26" onMouseOver="MM_showMenu(window.mm_menu_0527184307_0,103,27,null,'image1')" onMouseOut="MM_startTimeout();">
  <area shape="rect" coords="232,2,330,26" onMouseOver="MM_showMenu(window.mm_menu_0527184308_0,240,27,null,'image1')" onMouseOut="MM_startTimeout();">
  <area shape="rect" coords="343,3,466,27" href="../content/content/jobOpportunities.html">
  <area shape="rect" coords="480,1,572,27" href="../content/content/usefulLinks.html">
  <area shape="rect" coords="583,0,666,27" href="../content/content/contact.html">
  <area shape="rect" coords="679,0,732,27" href="../index.html">
</map>
</body>
</html>
<?php

    include_once('./manager/dbexit.inc');

?>
Code to display form results (list.php)

Code: Select all

<?php

    include_once('./manager/dbinit.inc');

    //$aid = untaint_digit($_GET['aid']);
    //if (empty($aid)) {
    //    $aid = untaint_digit($_POST['aid']);
    //}
    $cid = $_GET['cid[]'];
    if (empty($cid)) {
        $cid = $_POST['cid[]'];
    }
    $qid = escape_ascii($_GET['qid']);
    if (empty($qid)) {
        $qid = escape_ascii($_POST['qid']);
    }
	$joblocation = $_GET['stateId[]'];
	if (empty($joblocation)) {
  $joblocation = $_POST['stateId[]'];
	}
	
    $query = "cid={$cid}&qid=".urlencode($qid);
	
	

    $select = "SELECT DISTINCT ID, JobDate, JobTitle, JobLocation, Active";
    $from   = " FROM Jobs";
    $where  = " WHERE ACTIVE = 'Y'";
	
//load states array
	$catGroups = array(
	0  	=>  array("DC", "MD", "DE", "NJ", "PA", "NY", "CT", "RI", "MA", "NH", "VT", "ME"),
    1  	=>  array("MI", "IN", "KY", "TN", "MS", "AL", "GA", "FL", "SC", "NC", "VA", "WV", "OH"),
    2	=>  array("ND", "SD", "NE", "KS", "OK", "TX", "MN", "IA", "MO", "AR", "LA", "WI", "IL"),
    3	=>  array("WA", "OR", "ID", "MT", "WY", "CO", "NM", "UT", "AZ", "NV", "CA", "HI", "AK")
	);

//check state
	if (!empty($joblocation)) {
  $numArray = count($stateId);
  for($counter=0; $counter < $numArray; $counter++)
  {
  	if($counter = 0)
  	{
    $where .= " AND JobLocation='".$stateId[$counter]."'";
  	}
  	else
  	{
    $where .= " JobLocation='".$stateId[$counter]."'";
  	}
  	if($counter < ($numArray - 1))
  	{
    $where .= " OR";
  	}
  }
	}
// Category
    if (isset($gid) && $gid != "") {
      	$from  .= ", JobLookup";
  $is_not_first = 0;
    while(list($key, $val) = each($catGroups[$gid])):
    //print "<br>key:".$key." - val:".$val;
  	if(isset($is_not_first) && $is_not_first != 1){
      	$where .= " AND";
      	$is_not_first = 1;
      }
  	else{
    $where .= " OR";
  	}
    	$where .=  " JobLocation='".$val."'";
    endwhile;
    }
	//Job Location
	if (!empty($cid)) {
      $from  .= ", JobLookup";
      $where .= " AND ID=JID AND CID={$cid}";
    }
	
    // Author
    if (!empty($aid)) {
      $where .= " AND AID={$aid}";
    }

 

    // Query String
    if (!empty($qid)) {
      //$where .= " AND JobTitle LIKE '%{$qid}%'";
      $where .= " AND MATCH (JobTitle,JobDescription,JobQualifications) AGAINST ('{$qid}')";
    }

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Dialysis Search Incorporated - Mission and Values</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	margin-left: 0px;
	margin-right: 0px;
	margin-top: 0px;
	margin-bottom: 0px;
	
}
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style2 {
	color: #666666;
	background-repeat: repeat-x;
}
body {
	background-color: #FFFFFF;
}
.style3 {font-size: 12px}
a:link {
	color: #005594;
	text-decoration: none;
}
a:visited {
	color: #005594;
	text-decoration: none;
}
a:hover {
	color: #333333;
	text-decoration: underline;
}
a:active {
	color: #333333;
	text-decoration: none;
}
-->
</style>
<script language="JavaScript">
<!--
function mmLoadMenus() {
  if (window.mm_menu_0527182705_0) return;
                                    window.mm_menu_0527182705_0 = new Menu("root",140,17,"Verdana, Arial, Helvetica, sans-serif",11,"#CCCCCC","#005594","#005594","#CCCCCC","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0527182705_0.addMenuItem("Mission&nbsp;and&nbsp;Values","location='mission.html'");
  mm_menu_0527182705_0.addMenuItem("Company&nbsp;History","location='history.html'");
  mm_menu_0527182705_0.addMenuItem("Our&nbsp;Team","location='team.html'");
   mm_menu_0527182705_0.hideOnMouseOut=true;
   mm_menu_0527182705_0.bgColor='#555555';
   mm_menu_0527182705_0.menuBorder=1;
   mm_menu_0527182705_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0527182705_0.menuBorderBgColor='#FFFFFF';
    window.mm_menu_0527184307_0 = new Menu("root",197,17,"Verdana, Arial, Helvetica, sans-serif",11,"#CCCCCC","#005594","#005594","#CCCCCC","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0527184307_0.addMenuItem("Overview","location='candidateOverview.html'");
  mm_menu_0527184307_0.addMenuItem("Job&nbsp;Opportunities","location='jobOpportunities.html'");
  mm_menu_0527184307_0.addMenuItem("Submit&nbsp;Resume","location='submitResume.html'");
  mm_menu_0527184307_0.addMenuItem("Ensuring&nbsp;a&nbsp;Successful&nbsp;Search","location='successfulSearch.html'");
  mm_menu_0527184307_0.addMenuItem("Relocation&nbsp;Tools","location='relocationTools.html'");
  mm_menu_0527184307_0.addMenuItem("Career&nbsp;Resources","location='careerResources.html'");
  mm_menu_0527184307_0.addMenuItem("Testimonials","location='testimonials.html'");
   mm_menu_0527184307_0.hideOnMouseOut=true;
   mm_menu_0527184307_0.bgColor='#555555';
   mm_menu_0527184307_0.menuBorder=1;
   mm_menu_0527184307_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0527184307_0.menuBorderBgColor='#FFFFFF';
window.mm_menu_0527184308_0 = new Menu("root",197,17,"Verdana, Arial, Helvetica, sans-serif",11,"#CCCCCC","#005594","#005594","#CCCCCC","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0527184308_0.addMenuItem("Overview","location='clientOverview.html'");
  mm_menu_0527184308_0.addMenuItem("Featured&nbsp;Candidates","location='featuredCandidates.html'");
  mm_menu_0527184308_0.addMenuItem("Submit&nbsp;Job&nbsp;Order","location='submitJobOrder.html'");
  mm_menu_0527184308_0.addMenuItem("Ensuring&nbsp;a&nbsp;Successful&nbsp;Search","location='successfulSearch.html'");
  mm_menu_0527184308_0.addMenuItem("Staffing&nbsp;Resources","location='staffingResources.html'");
  mm_menu_0527184308_0.addMenuItem("Testimonials","location='testimonials.html'");
   mm_menu_0527184308_0.hideOnMouseOut=true;
   mm_menu_0527184308_0.bgColor='#555555';
   mm_menu_0527184308_0.menuBorder=1;
   mm_menu_0527184308_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0527184308_0.menuBorderBgColor='#FFFFFF';
mm_menu_0527184307_0.writeMenus();
mm_menu_0527184308_0.writeMenus();
} // mmLoadMenus()
//-->
</script>
<script language="JavaScript" src="../mm_menu.js"></script>
</head>

<body>
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="25%" style="">&nbsp;</td>
    <td width="742"><table width="742" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="742" height="144">
            <param name="movie" value="../content/flas/jobOpportunities.swf">
            <param name="quality" value="high">
            <embed src="../content/flas/jobOpportunities.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="742" height="144"></embed>
          </object></td>
        </tr>
        <tr>
          <td colspan="4"><img src="../images/jobOpportunities/middleBanner.jpg" name="image1" width="742" height="81" border="0" usemap="#Map" id="image1"></td>
        </tr>
        <tr>
          <td width="12" valign="top"><p>&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p>
              <p class="style2">&nbsp;</p></td>
          <td width="503" valign="top"><p align="justify"><span class="style1"><br>
            Job Opportunities</span></p>
            <!-- <? echo $select.$from.$where; ?> -->

    <p class='reset'><a href="search.php">New Search</a></p>

    <table border='0' cellpadding='4' cellspacing='2' width='475'>
    <tr width="600">
        <th align='left' width="75">Posted</th>
        <th align='left' width="325">Job Title</th>
        <th align='left' width="200">Location</th>
    </tr>
<?php
print "%^$^$#$^".$select.$from.$where;
  print $cid;
  print $stateId;

    $result = mysql_query($select.$from.$where)
        or die_gracefully(mysql_error(),"Could not complete query.");



    while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
        echo "<tr><td>{$row[JobDate]}</td>";
        echo "<td><a href='view.php?id={$row[ID]}&{$query}'>{$row[JobTitle]}</a></td>";
        echo "<td>{$row[JobLocation]}</td></tr>";
    }

?>
</table>
          <td width="227" valign="top" background="../images/slices/rightBannerBG.jpg"><img src="../images/jobOpportunities/rightBanner.jpg" width="227" height="496"></td>
        </tr>
    </table></td>
    <td width="25%" style="";>&nbsp;</td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="2,0,88,26" onMouseOver="MM_showMenu(window.mm_menu_0527182705_0,20,27,null,'image1')" onMouseOut="MM_startTimeout();">
  <area shape="rect" coords="94,2,219,26" onMouseOver="MM_showMenu(window.mm_menu_0527184307_0,103,27,null,'image1')" onMouseOut="MM_startTimeout();">
  <area shape="rect" coords="232,2,330,26" onMouseOver="MM_showMenu(window.mm_menu_0527184308_0,240,27,null,'image1')" onMouseOut="MM_startTimeout();">
  <area shape="rect" coords="343,3,466,27" href="../content/content/jobOpportunities.html">
  <area shape="rect" coords="480,1,572,27" href="../content/content/usefulLinks.html">
  <area shape="rect" coords="583,0,666,27" href="../content/content/contact.html">
  <area shape="rect" coords="679,0,732,27" href="../index.html">
</map>
</body>
</html>
<?php

    include_once('./manager/dbexit.inc');

?>

Posted: Thu Oct 07, 2004 10:04 am
by feyd
the following is the problem:

Code: Select all

$cid = $_GET&#1111;'cid&#1111;]'];
    if (empty($cid)) {
        $cid = $_POST&#1111;'cid&#1111;]'];
    }
    $qid = escape_ascii($_GET&#1111;'qid']);
    if (empty($qid)) {
        $qid = escape_ascii($_POST&#1111;'qid']);
    }
    $joblocation = $_GET&#1111;'stateId&#1111;]'];
    if (empty($joblocation)) {
  $joblocation = $_POST&#1111;'stateId&#1111;]'];
    }
Since the field names have brackets, they will automatically turn into arrays when php gets ahold of them. so $_GET/$_POST['stateId'] is an array of the submitted information.