If anyone has ideas pleas help!!

Ok, i have a drop down box generated from my database, the user can pick a option and then delete it from the database althoguh i doesnt seem to reogise it if it has a space in the word. How can i prevent this?

Below is my code

// code to generate drop down box
		$query="SELECT title FROM content ORDER BY title ASC";
		$result = mysql_query ($query);
		echo "<select name=title value=''>Title</option>";

		while($nt=mysql_fetch_array($result)){
		echo "<option value=$nt[title]>$nt[title]</option>";
		}
		echo "</select>";
				
//on the next page where its deleted the code is...
// we have something to delete
   	$SQLcmd = "DELETE FROM content WHERE title = '$title'";
 	mysql_query($SQLcmd, $con);
   
	// but did we delete anything....
   	if (mysql_affected_rows() == 0) {
      	echo "<p><font color=#C11B17>You were unsuccessful in deleting the information you requested! Please try again...</font></p>";
   		}
   		else 	{
      		echo "<p>**The information has been successfully deleted**</p>";
	}

Try this:

// code to generate drop down box
		$query="SELECT title FROM content ORDER BY title ASC";
		$result = mysql_query ($query);
		echo "<select name=title value=''>Title</option>";

		while($nt=mysql_fetch_array($result)){
		echo "<option value=\"$nt[title]\">$nt[title]</option>";
		}
		echo "</select>";
				
//on the next page where its deleted the code is...
// we have something to delete
   	$SQLcmd = "DELETE FROM content WHERE title = '$title'";
 	mysql_query($SQLcmd, $con);
   
	// but did we delete anything....
   	if (mysql_affected_rows() == 0) {
      	echo "<p><font color=#C11B17>You were unsuccessful in deleting the information you requested! Please try again...</font></p>";
   		}
   		else 	{
      		echo "<p>**The information has been successfully deleted**</p>";
	}

Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.