I'm trying to make insert extensions and the file type they display. Using a form I want to make it easier. So if someone submits: <img src="LOCATION" />, LOCATION is replaced with $file I'm using: <?php include("config.php"); if(isset($_POST['addextension'])) { $code = $_POST['code']; $type = $_POST['type']; $code = str_replace("LOCATION", " . $file . ", $code); @mysql_query("INSERT INTO `types` (code, type) VALUES ('" . $code . "', '" . $type . "')"); echo "Added"; } ?> PHP: Although $file is being ignored and only the dots are being inserted into the database, appreciate some help, thanks
$code = str_replace("LOCATION", $file, $code); Code (markup): Is $file being set before you try to replace "LOCATION" in the $code string? It could be that $file is blank. echo the $file before the str_replace to make sure you set the varable $file.