How to create a dropdown field

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
JSSIAdmin
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Oct 02, 2020 8:01 am

Tue Oct 06, 2020 9:39 am

I am creating a data entry form on my website (that operates via a login system).

This data entry form will have about 7 different entry fields, 4 of which are basic text, and 3 of which must be dropdown selection (prepopulated options). I would like the dropdown selections to be retrieved from a different table within the same database.
Also, how can I go about submitting this information to the database, to be included with the other fields? I have already got the field submission working for the the 4 basic text fields.
User avatar
Strider64
php-forum GURU
php-forum GURU
Posts: 421
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI
Contact:

Tue Oct 06, 2020 1:29 pm

This is a place to share and get help in how to write PHP, not to write code for you. Sorry, but I found honesty to be the best policy.
Life is a fig newton of your imagination! https://www.phototechguru.com/
JSSIAdmin
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Oct 02, 2020 8:01 am

Thu Oct 08, 2020 10:28 am

Perhaps I miscommunicated. I wasn't expecting someone to write the code for me. My goal was to obtain some form of reference or be given a direction on what to look for / research. My apologies, if I have incorrectly addressed my issue.

None-the-less, the problem has been sorted out. Is there somewhere specific I could look for these types of answers?
simonbrahan
php-forum Fan User
php-forum Fan User
Posts: 137
Joined: Mon Jun 08, 2020 2:00 am
Contact:

Thu Nov 19, 2020 7:16 am

If you are familiar with using PHP to print web page content from a table you're already most of the way there. You just need to use similar logic to create a "<select>" element in your form; you can loop over the rows from your table to create the "<option>" sub elements. I would give each item in your dropdown table an id, then you can use that id as the value of each option.
Post Reply