Jump to content

onChange update description


cleary1981

Recommended Posts

Hi All,

 

I thought this was going to be easy but theres alot more involved than I  thought. I can't find an example of what I want to do.

 

I have a drop down box that when a value is selected it should find the appropriate description from my db and display it in a span with id= description.

 

Heres the snippet of code from my html.

<div id="leftSide">
	<fieldset>
	<legend>Module</legend>
	<FORM name="drop_list">
	<label for="type">Type</label>
	<div class="div_texbox">
		<SELECT  NAME="Category" onChange="SelectSubCat();" >
		<Option value="">Select Type</option>
		</SELECT>
	</div>
  		<label for="mod_named">Model</label>
    		<div class="div_texbox">
		<SELECT id="model" NAME="SubCat" onChange="updateDesc();" >
		<Option value="">Select Model</option>
		</SELECT>
	</div>
	<fieldset>
	<legend>Description</legend>
	<span id="description">description goes here</description>
	</fieldset>
	<label for="mod_name">Name</label>
    		<div class="div_texbox">
    			<input name="username" type="text" class="username" id="username" value="" />
	</div>
	<div class="button_div">
		<input name="Submit" type="button" value="Generate" class="buttons" />
	</div>
	</form>
	</fieldset>
</div>

 

I know i need javascript for the updateDesc() and some php to query my db. Can anyone shed some light on this for a frustrated newbie?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/111995-onchange-update-description/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.