Can I link a drop down to a single database entry please?

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 123
Joined: Tue Mar 01, 2016 3:07 pm

Mon Sep 04, 2017 2:46 pm


I am just enquiring at present.

I'm unsure how to explain this, please bear with me.
I am looking into creating a search directory into my site, so users can Edit or Remove their entries, however I'm unable to link (or know how to go about) linking a drop menu to each of my database entries.

I'll try and make this a little clearer:-
I've so far set up my page so that the search results show (for example):- with a drop menu to the right with a drop menu to the right with a drop menu to the right
and so on.

Now if I want to Edit or Remove only the result, I'm unsure if I can, or how I link each drop menu to each entry.

Would it be easier if I had each search result list in a drop menu, so the user can choose which domain name to Edit or Remove. Or would there be a better way of achieving my goal?

Thank You.

New php-forum User
New php-forum User
Posts: 24
Joined: Sat Dec 02, 2017 3:12 pm

Sat Dec 02, 2017 6:23 pm

First. Stop using the phrases "drop down" and "drop menu". Makes me suspect you don't actually know which html elements are involved in the user interface / interaction you are trying to make.

If your search results are coming from a database then each one should have a unique identifier ( id ).

You would create another view (or another php web page) that looks for the unique ID inside of the $_GET superglobal array. If it finds one, it runs the code necessary to remove that item from the database and then redirect back to the main page that lists all of the items.

(it would be better to use a routing system for stuff like this instead of $_GET)

Post Reply