Page 1 of 1

problems with displaying info from forms

Posted: Fri Jan 02, 2004 12:11 am
by dakkonz
I want to display what the user has already submitted before in a form.
I am having problem displaying this select list.
My list is such a way that when the user choose CARS, another set of select options will be displayed and if BIKES is chosen there will be another set....
this code is on my edit page... I want to see what the user has chosen before.... I can only do it for the first select list... but cannot display whatever is it in the 2nd list

Code: Select all

<script language=javascript1.2>
IE = (document.all)?1:0;
NS = (document.layers)?1:0;
detail0 = '';

detailCARS='<option value="Porsche">Porsche</option><option value="Ferrari">Ferrari</option><option value="BMW">BMW</option>';

detailBIKES='<option value="Honda">Honda</option><option value="Phantom">Phantom</option>;

function ChangeDetail(pos) &#123;
	pos = pos.GENRE.options&#1111;pos.GENRE.selectedIndex].value;
	temp = '<select name="SUB">"<option value="0">Select a Sub-Genre</option>"' + eval("detail" + pos) + '</select>';
	if(IE)&#123;	newDetail1.innerHTML=(temp)&#125;
	else if(NS)&#123;
		document.newDetail1.document.write(temp)
		document.newDetail1.document.close()
		document.write("abcdef");
	&#125;
&#125;
</script>
<br><br><td><b>Selection:</b><select name="GENRE" onChange=ChangeDetail(this.form)>
<OPTION VALUE="0" selected>Select Genre</option>
<OPTION VALUE="CARS" <?php if (isset($g) && $g == "CARS") echo 'SELECTED';  ?>>Alternative Rock</option>
<OPTION VALUE="BIKES" <?php if (isset($g) && $g == "BIKES") echo 'SELECTED';  ?>>Blues</option>

</SELECT>
<BR>&nbsp&nbsp
  <div id=newDetail1> 
                                  <select name="SUB">
                                    <option value="0">-------------</option>
                                  </select>
                                </div>

Posted: Fri Jan 02, 2004 6:38 am
by m3mn0n
where is $g being defined?

Posted: Fri Jan 02, 2004 11:46 am
by dakkonz
$g is defined as the value obtained from the database