I have a database with a table containing names (for example "Mr Joe Blogs" could be one of the entries.)

On a page I have a form with a dropdown box populated from this table, which displays correctly. However, when I click submit only "Mr" is saved to the new entry in a different table. Here's my dropdown box code:

In the code for collecting the information from the form and sending it to the database I have this line:

$teacher = $_POST['teacher'];

If I print $teacher to the screen this error shows up, but it does't show up in $temp or nl2br($db_field["Name"]) if I were to use it directly.

Any clues why everything after the space is lost when I hit the submit button?

David.

tangoforce

01-18-2012, 01:55 PM

In the code for collecting the information from the form and sending it to the database I have this line:

$teacher = $_POST['teacher'];

If I print $teacher to the screen this error shows up, but it does't show up in $temp or nl2br($db_field["Name"]) if I were to use it directly.

You're not helping yourself..

WHAT error? - Does it say anything, show anything what?

You've also shown very little code. The code you've shown appears to be constructing the options for a select box's html source and yet you're here complaining about the code that saves the data to your database :confused:

djm0219

01-18-2012, 10:37 PM

The value in your select list must be enclosed in double quotes and you aren't closing your option tag correctly (not sure why you have a /tr instead of /option). Your select should also have double quotes are the name.