ok i have this code to insert into database from a form what i am trying to do is select which pic file should be entered this depends which type is selected on form eg if type = cat then pname = cat.jpg if type = dog then pname = dog.jpg if you see what i mean dont know where to put it cheers Doug <body> <?php //This gets all the other information from the form $state=$_POST['state']; $type=$_POST['type']; $area=$_POST['area']; $desc=$_POST['desc']; $name=$_POST['name']; $email=$_POST['email']; $tel=$_POST['tel']; $date = date("d-m-Y"); // Connects to your Database $dbh=mysql_connect("localhost", "caravan", "smu") or die('I cannot connect to database because: ' .mysql_error()) ; mysql_select_db("carav"); //Writes the information to the database mysql_query("INSERT INTO `register` VALUES ('$id', '$state', '$type', '$area', '$desc', '$name', '$email', '$tel', '$pname', '$date')"); PHP:
//This gets all the other information from the form $state=$_POST['state']; $type=$_POST['type']; $area=$_POST['area']; $desc=$_POST['desc']; $name=$_POST['name']; $email=$_POST['email']; $tel=$_POST['tel']; $date = date("d-m-Y"); $pname=$type.".jpg"; // Connects to your Database $dbh=mysql_connect("localhost", "caravan", "smu") or die('I cannot connect to database because: ' .mysql_error()) ; mysql_select_db("carav"); //Writes the information to the database mysql_query("INSERT INTO `register` VALUES ('$id', '$state', '$type', '$area', '$desc', '$name', '$email', '$tel', '$pname', '$date')"); PHP: