Hi all -

How can i echo back the value of of the following -

If the form has other errors - ie. if a user has missed filling in a field -
I can echo other fields if there are errors
Im just having some difficulties in echo-ing out the value selected from the drop down box -

Any pointers or advice would be appreciated - :)
error trapping

//trade experience
	if ( strlen( $tskl ) < 1 ) 
	{ 
		$msg_tskl = '<img src="img/loading.gif" width="16" height="16" 
		hspace="2" vspace="2" align="left" title="Select trade or service" alt="Select trade or service" />
		<font color="#21699e" size="-3">&nbsp;&nbsp;Select trade or service</font>';
		$b1=false;
	}

here is the part of the form - its a drop down box that is automatically populated from a mysql database -

<select name="wex" value='<? echo $experience; ?>' class="ta" id="wex">
                            <option value="">Select experience</option>
                            <?
                                 while($category_arr = mysql_fetch_array($result_wex)){
                                     ?>
                                     <option value="<?=$category_arr['experience']?>"><?=$category_arr['experience']?></option>
                                     <?
                                 }
                            
                            ?>
                    </select>

sorry here is the correct part of my error checking

//trade experience
	if ( strlen( $wex ) < 1 ) 
	{ 
		$msg_wex = '<img src="img/loading.gif" width="16" height="16" 
		hspace="2" vspace="2" align="left" title="Select you experience in years" alt="Select you experience in years" />
		<font color="#21699e" size="-3">&nbsp;&nbsp;Select your experience in years</font>';
		$b1=false;
	}
<select name="wex" value='<? echo $experience; ?>' class="ta" id="wex">

why you printing value in select box? with

value='<? echo $experience; ?>'

there is not value attr in select tag

try with

<select name="wex" class="ta" id="wex">

'select' tag can not have value.
Value is only for 'option'.
When form is submitted add this php code to debug it.
echo $_POST; exit;

hi thanks for all your help -

but everytime i submit the form all data slected is removed -
at the top of the form I have the following to populate each dropdown box -

$result_trade = mysql_query("select field from tblname ");

When i select a trade and submit the form, if there are validation error, the drop down box is not holding the value ?

Any ideas why this is happening

Use this code to remain selected last value.

<option <?=($_REQUEST['wex']==$category_arr['experience'])?('selected'):('');?> value="<?=$category_arr['experience']?>"><?=$category_arr['experience']?></option>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.