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

  • Home
  • SEARCH
  • 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 8978367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:35:40+00:00 2026-06-15T19:35:40+00:00

In my controller, i need some instructions to be launched only if a form

  • 0

In my controller, i need some instructions to be launched only if a form has been sent.

This is my controller:

public function indexAction() 
  {    

       $form   = array();
       $submit = $this->getRequest()->getParam('submit');


        if (!empty($submit))         
        {         

            $lastname = $this->getRequest()->getParam('last-name');
            $name     = $this->getRequest()->getParam('name');
            $email    = $this->getRequest()->getParam('email');

            $form     = array(

                'lastname' => $lastname,
                'name'     => $name,
                'email'    => $email);          

            $confirm      = Tools::checkInscription($form);

            var_dump($confirm);
            exit();

           if ($confirm === true)
           {        
                  Tools::saveUser($form);   
           }
           else 
           {
                  // Mets une variable a true pour savoir dans ta vu que tu as une erreur.  
                  $this->_redirect('/inscription');
           }


        }



  }

the problem is $submit always seems returning null.

My view:

        <form id="formulaire">
            <div class="msg">
                <p class="error">Merci de vérifier les champs en rouge</p>
            </div>
            <div class="last-name">
                <input type="text" class="error" id="last-name" name="last-name" placeholder="Votre nom" />
            </div>
            <div class="name">
                <input type="text" id="name" name="name" placeholder="Votre prénom"/>
            </div>
            <div class="email">
                <input type="text" id="email" name="email" placeholder="Votre email"/>
            </div>
            <button type="submit" title="Valider"></button>
        </form>

Can anyone help to find what i’m doing wrong
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-15T19:35:42+00:00Added an answer on June 15, 2026 at 7:35 pm

    Your submit button should be an input :

    <input type="submit" title="Valider" />
    

    And your form should have an action :

    <form id="formulaire" method="POST" action="some_page.php">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with this error The ObjectContext instance has been disposed and
I have this in my controller. I need my view to generate some HTML,
I need some guidance with this issue I have. I have a navigational Controller,
I need some help with this one.... I have this simple model: public class
I need some help with asp.net mvc Controller: <HandleError()> _ Public Class HomeController Inherits
Just need get some vals located in application.ini(main ini) in the Controller plugin I
Inside Controller I need to get a rendered string and do some actions with
In my application, I need to do some activity i.e pushing otherview controller,when I
I have a controller that runs some calculation on data, and then I need
At the moment I am doing this in each controller i need it :

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.