Jump to content

Recommended Posts

Hi,

 

I have a php page that list the items, for each item I want to have a "Move up" and "Move Down" button, so user can click on it to sort the list, for example, user click on "Move up" on item 3, it will become item 2, the original item 2 will become item3.

 

Anyone can provide a php code sample to do the tasks? Much appreicate it.

 

Ruby

Link to comment
https://forums.phpfreaks.com/topic/42557-move-updown-code-help/
Share on other sites

this is usually pretty simple. you're going to need a column in your items table in your database that stores this information. have a dropdown menu next to each item when the list is populated. this dropdown list will be pre-selected, meaning if an item is in spot #3, the dropdown menu next to it will already have 3 selected.

 

these items will all be within an HTML form, and upon submitting the form, it will update these fields in the specified column, and then, populate the list again with the same mysql_query as before.

Link to comment
https://forums.phpfreaks.com/topic/42557-move-updown-code-help/#findComment-206526
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.