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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:08:49+00:00 2026-06-07T04:08:49+00:00

I have an expression engine CMS which lists out a series of members and

  • 0

I have an expression engine CMS which lists out a series of members and allows the user to vote on each one and add comments. I then need to submit all these members as separate rows into a custom database table I created in my EE installation. I’m not sure how exactly to call the form that does the submitting from EE though. Here’s my code:

FORM

<tr>
    <td><input type="text" name="user[0][name]" value=""></td>
    <td><input type="text" name="user[0][party]" value=""><br></td>
    <td><input type="text" name="user[0][marks]" value=""></td>
    <td><input type="text" name="user[0][comments]" value=""></td>
</tr>
<tr>
    <td><input type="text" name="user[1][name]" value=""></td>
    <td><input type="text" name="user[1][party]" value=""><br></td>
    <td><input type="text" name="user[1][marks]" value=""></td>
    <td><input type="text" name="user[1][comments]" value=""></td>
</tr>

SUBMISSION CODE:

foreach($_POST['user'] as $user)
{
    $this->db->insert('mytable', $user);
}

But how do I call this php code from the EE form? Is it just a simple <form action="url.php">? And how would I set up that php code to utilize EE’s database connection strings?

  • 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-07T04:08:50+00:00Added an answer on June 7, 2026 at 4:08 am

    Aditya isn’t far off, you just need to instantiate EE. So for your form targets a result page/template as normal html, for example: <form action="/form-result"> (or whatever), then the quick and dirty way would be simply to include PHP in the template receiving the form.

    On that page (receiving the form), have the following (template must have PHP enabled):

    <?php
    $EE =& get_instance();
    $postUsers = $EE->input->post('user');
    
    foreach($postUsers as $user) {
        // Extra Cleaning
        $user = $EE->db->escape_str($user);
        $user = $EE->security->xss_clean($user);
        // Fields and values to save to DB
        $dbFields = array(
            'user' => $user['name'],
            'party' => $user['party'],
            'marks' => $user['marks'],
            'comments' => $user['comments']
        );
        // Prefix variable used for good practice, but could hard code
        $EE->db->insert($EE->db->dbprefix . 'mytable', $dbFields);
    }
    ?>
    

    I’ve shown the long method of recreating the array to send to the DB in case you want to modify or add more fields, but you could simply just pass $user (after cleaning) to the database as the array will have the same structure.

    If it’s multiple POST variables sent by the form (instead of the array you imply), you’d need something like:

    foreach($_POST as $var) {
        $postUsers = $EE->input->post($var);
    

    A more ideal solution would be developing a plugin that would be called from the resulting template to trigger the above, or an extension that ‘listened’ for the appropriate form to be submitted, possibly by using the ACT security ability built into EE. But that’s probably added an unnecessary level of complexity for your requirement.

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

Sidebar

Related Questions

I have a website created using codeigniter framework. I am using expression engine cms
I am using expression engine 2.4.0 . I have the plugin in a correct
So far I have the expression: http://[^\.]*\.mydomain\.com/((.*?)) Which matches... http://www.mydomain.com/Images/favicon.ico But I really dont
I need to combine Expression Engine with http://www.infinite-scroll.com . I have tried numerous ways
I am using Expression Engine and have a rule in my htaccess to rewrite
I'm building in Expression Engine 2.3 a user profile system using Solspace's User and
I'm developing an add-on for Expression Engine that has a search facility. For search
I have a form submitting with {exp:channel:entry_form} on Expression Engine 2.3. I'm upgrading a
In expression engine: I have a site that businesses can sign up and then
i have to make some updates to a web site built using expression engine.

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.