Very simple PHP/HTML question for a Yes/No radio button and list.

How would I make this be a simple Installed/Not Installed radio button?  I have everything working right now with submitting from a text box but I don't want to give them the option of filling out a text box for this part.

<strong>Installed:</strong> <input type="text" name="Installed" value="<?php echo $Installed; ?>" />

Open in new window

Lastly, how would I make this a list of names instead of having them type in their names.  For example the managers would be Bob, Joe, and Jason.  How can I make this a list instead?

<strong>Manager:</strong> <input type="text" name="fmanager" value="<?php echo $fmanager; ?>" />

Open in new window

Thank you in advance
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.

Mark BradyPrincipal Data EngineerCommented:
I would generate both controls (radio buttons and a select element) in php based on a query to the database. Obviously php would query their user account or where ever the data is stored to get their manager info.

You can have php build the radio buttons for you and they will be set according to what is in the database. Of course if you are hard coding the results then you would just do something like this.

<input type="select" id=manager" name="manager" onchange="update_manager()">
<option value="">Select a manager</option>
<option value="Bob">Bob</option>
<option value="Joe">Joe</option>
<option value="Jason">Jason</option>

Open in new window

The onchange part is in case you wanted to use ajax to update their manager when it gets changed.

Build the radio buttons in the same way with php so you get the current selection for that user from the database then as you go through the building of the element, add the word selected to the correct radio button.

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
Ray PaseurCommented:
Chris StanyonWebDevCommented:
The first line of Marks code should be:

<select id=manager" name="manager" onchange="update_manager()">

Open in new window

As for a radio, you'd use something like this:

<input type="radio" name="installed" value="yes" id="installedYes" checked> <label for="installedYes">Yes</label><br>
<input type="radio" name="installed" value="no" id="installedNo"> <label for="installedNo">No</label><br>

Open in new window

The label allows you to click on the Yes/No test to select the option and the check attribute means that value is checked by default.
Mark BradyPrincipal Data EngineerCommented:
Thanks Chris - My bad!
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.