on load populate combo box from php value

here my problem
i have a combobox that populates schools..i want topass the value of this school to a php page that has a combobox init and if the value = a value then it selects that value.


Wittenberg University
University of Louisville
West Liberty State College

user has picked school 2 from previous page. and this value is in $school_pick as "University of Louisville"

how do i get an onload for the combo box to populate the combo box to reflect that please

thank you for any help and code you may propvide
i thought i could do this but its not working
<body bgcolor="#ffffff" link="#5e2f2f" text="#000000" vlink="#666666"  onLoad='document.form.School.selectedIndex = "2";'>

<P><strong> College: &nbsp;
    <SELECT name='School' size='1' onChange='reloadCities(this.selectedIndex);' onclick='enableLoft();'>
      <OPTION value='0'></option>
      <OPTION value='Wittenberg University'>Wittenberg University</option>
      <OPTION value='University of Louisville'>University of Louisville</option>
      <OPTION value='West Liberty State College'>West Liberty State College</option>
&nbsp; &nbsp;&nbsp; &nbsp;
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here is one way of doing it:

<?php $selected = 'selected="selected"'; ?>
<SELECT name='School' size='1' onChange='reloadCities(this.selectedIndex);' onclick='enableLoft();'>
  <OPTION value='0'></OPTION>
  <OPTION value='Wittenberg University' <?php if($school_pick == 'Wittenberg University') echo $selected; ?>>Wittenberg University</OPTION>
  <OPTION value='University of Louisville' <?php if($school_pick == 'University of Louisville') echo $selected; ?>>University of Louisville</OPTION>
  <OPTION value='West Liberty State College' <?php if($school_pick == 'West Liberty State College') echo $selected; ?>>West Liberty State College</OPTION>

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnnyAuthor Commented:
thank you
JohnnyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.