This is probably a dumb question but I have a problem with echoing back values that I have selected from a multiple-select dropdown (dynamically populated with values from the database) and from input text fields sharing the same name. The user can either select multiple names from a dropdown of already existing professors or add a new professor to the database or both.
here is my form code: [php]
</select> </td> <td> add more: <input type="text" name="professor" id="input" size="20" /> <br /> add more: <input type="text" name="professor" id="input" size="20" /> <br />[/php]
When the form gets processed, I want to echo back all the values inserted.
snippet of my post code[php]
$professor = $_POST[‘professor’];
$professordrop = $_POST[‘professordrop’];
snippet of my echo code:
echo ‘Professor(s): ‘.$professordrop.’
echo ‘Professor(newly added) :’ .$professor.’
echo 'Course Number: '.$courseno. ‘
echo 'Semester: '.$semester. ‘
I fiddled around with it. When the post code is at the very top, the echo will only echo back the last of the array. I have several foreach statements in between the post and echo codes. Is that messing things up? When I copy and paste the post code so that I ahve a copy before I start the echo, I get the string ‘Array’.