Hi all,

I'm building a questionnaire and would like to know how i can get a selected option to stay selected after clicking submit.

thanks

paul

ive tried the following, but not the final solution yet.

<option<?php if ($question1 == "Gone to Competitor"){ 
						echo "selected=\"selected\""
						};
						?> >Gone to Competitor</option>

You can also use below reduced code.

<option <?=($question1 == "Gone to Competitor")?'selected="selected"':''?> >Gone to Competitor</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.