I am bigginer in php. i want create a small admin section for an institute. i have admin table and students details table in my sql. i know , how to insert and update the data. but in my application there is one dropdown list for student courses.what ever i want to select in that, that only stored in to database. in updating time also if student was change his course then i want to change course name through dropdown. i dont know how to use dropdown. please reply me.

Two possibilities:
1. (easier) - create a site for each student each
make a list of all students and link them to a to a page where detailed information about the student are given. Now you can use dropdowns for the admin to change stuff.
2. (trickier) - list all students editable on the main page
list all students and make dropdowns for their information. In this case you have to enumerate the dropdowns through as an array. eg:

for($x=0;$x<count($result);$x++){
echo "<select name=\"course[".$x."]\"></select>";
}

When sending the data via POST, you have to go through the array and save the data in the database. It can be a bit fussy to reassociate each index with the person.

Now how to access data from dropdown?
- put dropdowns between <post> and </post>
- name them! eg

<select name="course">

- give all items a value" eg

<option value="first grade">First Grade</option><option value="second grade">Second Grade</option>

- you can now access the data in PHP like this:

echo $course;

which will output "first grade" or "second grade" depending on which option the user has selected.

This article has been dead for over six months. Start a new discussion instead.