I've got this form, in which there is an intial 'owner' name for a pet (part of a virtual pet adoptions fansite), and people can input the adopter name into the form. If an adopter name is entered, I want the owner name to switch and become the adopter name.. but if none is entered, I want the owner name to stay the same when the form is update. However, the way it's coded curently, even though my DEBUG statements seem to be working, the owner name is /always/ becoming the adopter name. Any ideas why this is and how to fix this?
$owner1 = $owner;
if(!$adopter)
{ $owner = $owner1; print("DEBUG IF"); }
else
{ $owner = $adopter; unset($adopter); print("DEBUG ELSE"); }
$result=mysql_db_query("neopets","UPDATE pet SET ownername='$owner' WHERE id = $edit_pet;",$database);
And the code for the two input areas of the form is:
<tr><td>Owner:</td>
<td><?php print $owner; ?></td></tr>
<tr><td>Adopter Username:</td>
<td><textarea cols="30" rows="1" wrap="soft" name="adopter"></textarea></td></tr>