This code is part of an Edit Item page which defaults to the previous selected catalogue, however, I want to insert the approproriate number for each instance. For example, the first will be 1 the second 2 and so on.
Seems simple enough, but I've had no luck storing the index value in the database.
It only seems to want to insert the text of it, however, I want to insert '1' if A / W 2006 is chosen, 2 if S /S 2007 is chosen , etc.
<p><b>Catalogue :</b><br />
<select name="catalogue" size="1">
<option></option>
'."\n";
$catalogues = array('Autumn / Winter 2006', 'Spring / Summer 2007', 'Autumn / Winter 2007', 'Spring / Summer 2008', 'Autumn / Winter 2008');
for($i = 0, $j = count($catalogues); $i < $j; $i++){
echo '<option value="'.$catalogues[$i].'"'.(($catalogues[$i] == @$row[6])?' selected="selected"':'').'>'.$catalogues[$i].'</option>
'."\n";
}
echo ' </select></p>
Currently I'm using $catalogue = $_POST['catalogue']; then putting it in the SQL query, but it only takes the text. How do I get the relevant index no?
Thanks for any suggestions!