list box wont store variables
Posted: Tue Aug 28, 2007 1:25 pm
I have a list box which loads up data from database as shown below:
I have attempted here:
process page:
What happens then is the user selects one of the options and presses "buy" upon buy being pressed the selected choice should be bought, how ever i cannot get it to assign it to variables.Code: Select all
<?php $soldhousesquery = "SELECT Price, HouseType FROM soldhouses ORDER BY Price ASC"; $soldhousesresult = @mysql_query($soldhousesquery) or die(mysql_error()); echo '<select name="BuyCombo" size="6" id="Combobox3" style="position:absolute;left:343px;top:450px;width:223px;font-family:MS Shell Dlg;z-index:25">'; while($soldhousesrow = mysql_fetch_array($soldhousesresult)) { echo "<option value=\"{$soldhousesrow['Price']}|{$soldhousesrow['HouseType']}\">£ {$soldhousesrow['Price']} - {$soldhousesrow['HouseType']}</option>"; } echo '</select>'; echo '<input type="submit" />'; echo '</form>'; ?>
I have attempted here:
process page:
When i echoed $HousePrice and $HouseType the result was blank. Any one see where i gone wrong?Code: Select all
$value = $_POST['houselist']; $posistion = strpos($value, '|'); if ($posistion !== false) { $HousePrice = substr($value, 0, $posistion); $HouseType = substr($value, $posistion+1); }