php form dropdown won't populate existing data

This is my code, I have a dropdown on a form. I'm working on an EDIT screen. The form loads the proper data, but no matter what I do it won't show the proper data Y or N. This is only one way I've been trying it.

<p><strong>Sold?</strong>
<select name="fsold" value="<? print $sold?>">
      <option value="N">No</option>
      <option value="Y">Yes</option>
</select>
</p>
StarThunderAsked:
Who is Participating?
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.

Ray PaseurCommented:
The HTML select control does not use the attribute "value=" which is reserved for the option control tag.  What is in your action script?  How do you go about finding the value of the request variable "fsold" ?
0

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
StarThunderAuthor Commented:
while ($row = mysql_fetch_array($query))
{
      $name = $row['Name'];
      $descrption = $row['Description'];
      $price = $row['Price'];
      $dogtype = $row['DogType'];
      $dogsex = $row['DogSex'];
      $sold = $row['sold'];
      $mainpic = $row['MainPic'];
      $pic01 = $row['Pic01'];
      $pic02 = $row['Pic02'];
}
?>


<form method=post action="do_dogfileget.php" ENCTYPE="multipart/form-data">

<p><strong>Dog's Name</strong>
      <input type="text" name=fname size=40 maxlength=40 value="<? print $name?>">
</p>


This is the text before the earlier text. fsold = $sold

What I'm looking for is how to display the value already in the record, like "N".
0
StarThunderAuthor Commented:
Thanks for offering help, but I figured it out. Here is the code...

<p><strong>Dog Type</strong>
<select name="fdogtype">
<?
      if($dogtype == "A")
      {
            print "<option value=\"A\" selected=\"A\">Adult</option>";
      }
      else
      {
            print "<option value=\"A\">Adult</option>";
      }
      
      if($dogtype == "P")
      {
            print "<option value=\"P\" selected=\"P\">Puppy</option>";
      }
      else
      {
            print "<option value=\"P\">Puppy</option>";
      }
?>
</select>
</p>
0
StarThunderAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for StarThunder's comment #a39504816

for the following reason:

I came up with the solution on my own.
0
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
Printers and Scanners

From novice to tech pro — start learning today.