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 8316539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:23:08+00:00 2026-06-08T21:23:08+00:00

I am developing a simple students information application. I have student list in my

  • 0

I am developing a simple students information application. I have student list in my index.phtml and I can edit student information form there. It’s working nice but I want to use modal for edition student info. But I don’t know how to do this.Below I have posted my current codes :

/// indexController.php

public function editAction()
    {
        $modelStudents = new Application_Model_DbTable_Students();
        $id = (int) $this->_getParam('id');

        $student = $modelStudents->fetch($id);

        $form = new Application_Form_Student($student->email);
        $form->submit->setLabel('Save');
        $this->view->form = $form;
       if ($this->getRequest()->isPost()) {
            $formData = $this->getRequest()->getPost();
            if ($form->isValid($formData)) {
                $id = (int)$form->getValue('id');
                $name = $form->getValue('name');
                $email = $form->getValue('email');
                $phone = $form->getValue('phone');
                $students = new Application_Model_DbTable_Students();
                $students->updateStudent($id, $name, $email, $phone);

                $this->_helper->redirector('index');
            } else {
                $form->populate($formData);
            }
        } else {
            $id = $this->_getParam('id', 0);
            if ($id > 0) {

                $form->populate($modelStudents->getStudent($id));
            }
        }

    }

/// index.phtml

<html>
<head>
<style type="text/css" rel="stylesheet">
</style>
<script type="text/javascript" src="jQuery.js"> </script>
<script type ="text/javascript" src="jquery.simplemodal-1.4.2.js" ></script>
<script>

<?php         
echo "Student List";

?>
<p><a href="<?php echo $this->url(array('controller'=>'index', 
        'action'=>'add'));?>">Add new student</a></p>
<table border="1">
<tr>
    <th>Name</th>
    <th>Email</th>
    <th>Phone</th>

    <th>Action</th>

</tr>
<?php foreach($this->students as $student) : ?>
<tr>

    <td><?php echo $student->name;?></td>
    <td><?php echo $student->email;?></td>
    <td><?php echo $student->phone;?></td>

    <td>
        <a href="<?php echo $this->url(array('controller'=>'index', 
            'action'=>'edit', 'id'=>$student->id));?>">Edit</a>
        <a href="<?php echo $this->url(array('controller'=>'index', 
            'action'=>'delete', 'id'=>$student->id));?>">Delete</a>
        <p id="delete" > Delete </p>
    </td>
</tr>
<?php endforeach; ?>
</table>

</center>
</html>

////edit.phtml

<center>
<?php 

echo "Edit Student List ";
echo $this->form ;
?>
</center>

Please let me know how to use jQuery simple modal plugin to preform this task.
Thanks in advance

  • 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-06-08T21:23:10+00:00Added an answer on June 8, 2026 at 9:23 pm

    Start by editing your index.phtml file to add a class and the student id to your edit link:

    <a href="<?php echo $this->url(array('controller'=>'index', 
                'action'=>'edit', 'id'=>$student->id));?>" class="editBtn" studentId="<?=$student->id?>">Edit</a>
    

    Then, in an included js file:

    $(document).ready(function() {
    
        $(function() {
            //Event triggered when clicking on the edit btn
            $('.editBtn').click(function(event) {
                event.preventDefault ? event.preventDefault() : event.returnValue = false;
                //Get the page and add it to the modal
                studentId = $(this).attr('studentId');
                var data={};
                data['id'] = studentId;
                url = "/index/edit/";
                $.get(url, data, function(resp) {
                    $.modal(resp);
                });
            });
        });
    
    });
    

    This should help you get started…

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

Sidebar

Related Questions

I'm developing a simple Android application that would have an action bar on the
I am developing simple travel agent android application. When application starts it loads list
Im developing a simple application that have a line like this: string[] values =
im developing a simple Mxml application using flex 3. I have used simple text
I'm developing a simple JSF application, but I'm stuck again... Basically, I have a
Hi I am developing a simple application based upon ASP.NET MVC. I have altered
So, i am developing simple web application using Spring Framework. The application users can
Can anyone recommend a good Java game engine for developing simple tile-based games? I'm
I'm developing a simple program which makes a Python script executable, and I'm working
I am developing a simple pyramid application where I am using JQuery to do

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.