Drop-down/textbox combo not INSERTing

I have a drop-down box where name=“tier_item_brand1”, and under it a textbox where name=“tier_item_brand2”. If the contents of the drop-down box don’t have the desired answer, then one could enter the proper text in the textbox.

I need to insert one of those values into the table field “tier_item_brand.” For some reason, the following code does not insert the textbox contents, leaving the field blank instead. Can you help?

// brand1 = drop-down. brand2 = textbox.
if (isset($_POST['tier_item_brand1'])){
	$tier_item_brand = $_POST['tier_item_brand1'];
	$tier_item_brand = mysql_real_escape_string($tier_item_brand);
	}else{
if (isset($_POST['tier_item_brand2']))
	$tier_item_brand = $_POST['tier_item_brand2'];
	$tier_item_brand = mysql_real_escape_string($tier_item_brand);
}
$cover_tiers = mysql_query("INSERT INTO cover_tiers SET
tier_level = '$tier_level',
tier_item_name = '$tier_item_name',
tier_item_brand = '$tier_item_brand'");

Thanks!
Steve

Hi, Steve.

Try this:


<?php

// brand1 = drop-down. brand2 = textbox.

if (isset($_POST['tier_item_brand1'])){

    $tier_item_brand = $_POST['tier_item_brand1'];

    $tier_item_brand = mysql_real_escape_string($tier_item_brand);

    }else{
    
    $tier_item_brand = $_POST['tier_item_brand2'];

    $tier_item_brand = mysql_real_escape_string($tier_item_brand);

}

$cover_tiers = mysql_query("INSERT INTO cover_tiers SET

tier_level = '$tier_level',

tier_item_name = '$tier_item_name',

tier_item_brand = '$tier_item_brand'"); 

?>

Thanks,
Kevin