Click to See Complete Forum and Search --> : [RESOLVED] Variable assignment problem


DMP23
04-19-2006, 11:02 AM
having trouble inserting a variable into the database..it keeps inserting "type1" instead of the would be value. Im sure its simple problem.
please advise
here is my code:

if(move_uploaded_file($_FILES['the_file']['tmp_name'], './img/' . $_FILES['the_file']['name']))
{


$location = "./img/" . $_FILES['the_file']['name'];
$type = 'type1';
print "OK ".$location;

mysql_query("INSERT INTO blueprints2 (blueprint_id, name, location, type, storys, bedrooms, bathrooms) VALUES(NULL,'".$_FILES[the_file][name]."','$location','$type','two',1,2)") or die("Insert Error".mysql_error());

}
else print "Nope".$_FILES['the_file']['tmp_name'];




mysql_close();
} else{

?>

<form action="store_binary2.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value ="100000" />

select a file to upload:<input type="file" name ="the_file" />
<br/>


<select name="type1">
<option value="detached"> detached </option>
<option value="split"> split</option>
<option value="semi"> semi</option>
</select>
<input type="submit" name="submit" value="submit!" />

</form>

NogDog
04-19-2006, 11:06 AM
Change $type = 'type1'; to $type = $_POST['type1'];

DMP23
04-19-2006, 11:12 AM
thanx for suggestion NogDog but its still posting "type1 into the DB"

DMP23
04-19-2006, 11:14 AM
my apologies - that did work. :) i just had to rejig