Jump to content

Sort a list using first letter of Surname.


maya_bglore

Recommended Posts

Hello all,

 

I would be getting the following entries from a user in the format,

FirstName    SurName    RollNum    Marks

Linda              Jones        345            78

Abby                Gail            100            90

Mark                Polo            234          67

 

The issue is to rearrange the list by sorting the first letter in surname.How do I

go about this??

 

thanks in advance,

 

Link to comment
Share on other sites

sorry..I havent yet done the form..but that is the requirement.User selects the number of entries he want to feed into the system.testboxes are then generated accordingly.All the details are entered and submitted.Once the sorting is done,the list needs to be displayed.

Link to comment
Share on other sites

Right, i would suggest that you name each of your form items as arrays:

<input type="text" name="firstname[]" />

<input type="text" name="surname[]" />

 

You will then have arrays of the following: firstname, surname, roll number and marks. Use the function asort() to sort the surname array whilst maintaining the keys. You can then loop through the array and pull the data from the other arrays with the corresponding keys. Hope that makes some sense :P

Link to comment
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.