problems with displaying info from forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

problems with displaying info from forms

Post 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>
Last edited by dakkonz on Sun Jan 04, 2004 10:08 am, edited 3 times in total.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

where is $g being defined?
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

Post by dakkonz »

$g is defined as the value obtained from the database
Post Reply