ramone_johnny Posted April 9, 2013 Share Posted April 9, 2013 (edited) I'm hoping someone can help me out with this, I'm relatively new to PHP as my background is ASP, so I'm a bit stuck. I'm using the following code as demonstrated here htmlblog.us/jquery-autocomplete ...and I've customized it (slightly) to pull information from my mysql database. Everything is working fine, however, my problem is that when the user selects a specific location from the dropdown, its passing over the suburb, the state, and the postcode. I only want to pass over the postcode value, so I can handle the results easily on the search results page. If I use this.... while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) ) { $data[] = array( 'label' => $row['pcode_area'] .', '. $row['pcode_state'] .' '. $row['pcode_postcode'] , 'value' => $row['pcode_area'] .', '. $row['pcode_state'] .' '. $row['pcode_postcode'] .'; ' ); It posts this to my search results page... (eg showing a search for Brisbane, QLD; 4000) Array ( [zipsearch] => BRISBANE, QLD 4000; ) I only want the postcode value. So instead, I would like ... Array ( [zipsearch] => 4000; ) I tried doing this.... while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) ) { $data[] = array( 'label' => $row['pcode_area'] .', '. $row['pcode_state'] .' '. $row['pcode_postcode'] , 'value' => $row['pcode_postcode'] .'; ' ); ..which passes over just the postcode like I want, but that's no good because upon selection, the suburb and state disappear leaving just the postcode in the selection box, which may confuse people. I'm pretty sure there's an easy way to do this, but being new to PHP, I'm a bit lost. I would really appreciate some help with this, as I'd like to get this sorted ASAP. Thank you. John Edited April 9, 2013 by ramone_johnny Quote Link to comment Share on other sites More sharing options...
ramone_johnny Posted April 9, 2013 Author Share Posted April 9, 2013 Anyone at all? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.