Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5985925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:36:00+00:00 2026-05-22T22:36:00+00:00

i have an employee table with fields like id, name, age and salary. Iam

  • 0

i have an employee table with fields like id, name, age and salary.

Iam showing the list of employee names in my custom module and when i click on an employee name, i have to show the edit form of that employee.

The employee names are given a link, as like:

<a href='".$base_url."/my_module/edit/".$employee->id."'>

and the corresponding menu path is configured as:

$items['my_module/edit/%'] = array(
        'title' => t('My form'),
        'description' => t('Edit employee'),
        'page callback' => 'my_module_edit',
        'access arguments' => array('access content'),
        'access callback' => TRUE,        
        'type' => MENU_CALLBACK,
    );

And when i click on the 5th employee name, the url would be: …./my_module/edit/5

So now my questions are:

  1. How can i get the id (5) of the employee from the url in my my_module_edit function ?
  2. How can i show the edit form of the employee, populating the fields (by querying with id) ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:36:01+00:00Added an answer on May 22, 2026 at 10:36 pm

    For question 2: You have got it mixed up a bit, you don’t create a custom ‘page callback’ menu item for forms, you should use ‘drupal_get_form’ as the ‘page callback’ with the name of your form() function (my_module_employee_form) as the ‘page arguments’.

    function my_module_menu() {
      $items['my_module/employee/edit/%'] = array(
         'title' => t('Edit employee'),
         'page callback' => 'drupal_get_form',
         'page arguments' => array('my_module_employee_form', 3),
         'access arguments' => array('administer my_module'),
         'type' => MENU_CALLBACK,
       );
     }
    
    function my_module_employee_form() {
      ... read database and generate form..
    }
    
    function my_module_employee_form_submit($form_id, &$form) {
      ... read form and update database ...
    }
    

    Then in the function my_module_employee_form() you generate the form and populate it, and in my_module_employee_form_submit() you read the values back and store them in the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table called Employee with the following fields: EmpID Salary Name I
I have a table showing a list of objects; let's call them Employee for
I have two table Employee and Salary table, salary consists Salary of employee in
I have the following database design: Employee Table: Username, Name, DivisionCode Division Table: SapCode,
I have 2 tables: employee and employeedetails . employee looks like this: id name
I have a simple table Employees with this fields: ID, ParentID, Name ParentID is
I have the following JPA (2.0.2) entities: Employee @Entity @Table(name = T_EMPLOYEE) public class
I have a table (EmpInfo) where employee info stored. Here are the fields: EMPLID
I have a EMP table in my database with the following fields: id,name,post,joining_date. Whenever
I have 2 tables. tb_Employees tb_Orders tb_Employees has the following fields empID name tb_Orders

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.