无法从下拉列表中选择结果

I am new to this and i am trying to write a script where it will query the DB and return all the usernames in a drop down list and then to copy out the selected name and then when you register a Dog to them it will copy the name into the DB, So Owners can have many dogs but dog can only have 1 owner... i can enter Name and Breed but not the results from the drop down list, i did try to get java script to pull the selected item in drop down to be where the $ownername is in in the 'insert into...' script

can you send me a message if you can help me with this i will link you the files to download

mysql_query("INSERT INTO `dog`(`id`, `dogname`, `breed`, `owner`)
 VALUES  ('', '$reg_dogname', '$breed', '$row');") or die (mysql_error());
     $userid = mysql_insert_id();

}}


$sql = mysql_query('SELECT `username` FROM  `users`');
$ownername = array();
while ($row = mysql_fetch_array($sql)){ 
    $ownername[] = $row;

 <select id="dropdown" name="dropdown" onchange="selectDropdown()">
  <?php
  foreach ($ownername as $ownername1) {
  ?> 
  <option value="<?php echo $ownername1['username']?>">
    <?php echo $ownername1['username']?>
    </option>
  <?php
  }
  ?>
  </select> 

It will be difficult to give you a problem specific answer until you post your code, but I think this would work pretty well for you:

-create relational tables for owners, breeds, and dogs:

Table: owners
Fields:
id_key: integer, auto number, primary key - table index
owner: varchar, 16 character, unique index - account records (unique prevents duplicate account records)
password: varchar, 32 character (assuming you are using md5 encryption, you will always get a 32 character result. Additional security concerns are beyond the scope of this question)
any other account related fields (but not dogs, give them their own table)

Table: breeds
Fields:
id_key: integer, auto number, primary key - table index
breed: varchar, 16 character, unique - available dog breeds

Table: dogs
Fields:
id_key: integer, auto number, primary key - table index
dog: varchar, 16 character, index - dog owned by account
breed: varchar, 32 character, index, foreign key= breeds.breed on delete=restrict on update=cascade (prevents duplicate breed entries during data entry)
owner: varchar, 16 character, index, foreign key= owners.owner on delete=cascade on update=cascade (this constricts the dog owner to existing accounts)

Then make a form something like this:

<?php
$formdata=array(
    owners => array(),
    breeds => array()
);
require_once 'dbconnection.php';
echo '<form id="dog_input" name="dog_input" method="post">';
$result=mysql_query("SELECT `owner` FROM owners;");
while ($row = mysql_fetch_row($result)) {
    array_push($formdata[owners], $row[0]);
}
$result=mysql_query("SELECT `breed` FROM breeds;");
while ($row = mysql_fetch_row($result)) {
    array_push($formdata[breeds], $row[0]);
}
?>
<FORM name="dog_input" method="post" action="dog_data.php">
    <ul>
        <li>
            <label for="owner">Dog Owner</label>
            <SELECT name="owner" id="owner">
            <?php
                foreach ($formdata[owners] as $i) {
                    echo '<OPTION>'.$i.'</OPTION>';
                >
            ?>
            </SELECT>
        </li>
        <li>
            <label for="breed">Dog Breed</label>
            <SELECT name="breed" id="breed">
            <?php
                foreach ($formdata[breeds] as $i) {
                    echo '<OPTION>'.$i.'</OPTION>';
                >
            ?>
            </SELECT>
        </li>
        <li>
            <label for="dog">Dog Name</label>
            <INPUT type="text" name="dog" />
        </li>
        <li><INPUT type="submit" value="Submit /></li>
    </ul>
</FORM>

Then you need to create the validation script that will check your results and enter safe data into the database:

<?php
    /*
    * dog_data.php - checks data and inserts it into the database.
    */
    require_once 'dbconnection.php';
    $owner = $_POST['owner'];
    $breed = $_POST['breed'];
    $dog = mysql_real_escape_string($_POST['owner']);
    //perform any additional data validation here, use an if statement to check validation before insert query if you do so
    mysql_query("INSERT INTO `dogs` (`id_key`, `owner`, `breed`, `dog`)
                 VALUES(DEFAULT, '".$owner."', '".$breed."', '".$dog."');");
    mysql_close($con);
    header(" Location: http://www.example-redirection-page.com");
?>