html - Set select option using php when reloading the same page -


I have selected a php population and given a matching value using PHP from the loop through the results of a SQL query has gone. $ result = mysqli_query ($ con, "definitely select *") echo "

This gives me a populated drop down list with all the syllabus titles, on the submission I selected by using the $ _ POST ['CourseSelect'] I can use the value;

However, the drop down (selection) resets itself when the page is reloaded.

How can I use php?

I know

For example, while the page is loading, the second option will be selected:

  & lt; Select & gt; & lt; option & gt; a & lt; / option & Gt; & lt; option selected & gt; two & lt; / option & gt; & lt; option & gt; three & lt; / option & gt; & lt; / select & gt;   

You can make it simpler

  while ($ line = mysqli_fetch_array ($ Results)) {$ select = ''; if (isset ($ _ POST ['coursch']) and $ _POST ['select course']] == $ line ['title']) $ select = 'selection '; Echo' '& lt; Option value = '". $ Line [' title '].' ''. Select $. "&" Gt; " $ Line ['title'] "& lt; / option & gt;"; }    

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -