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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:10:57+00:00 2026-06-12T18:10:57+00:00

I have a Notice: undefined variable error that I cannot solve: Notice: Undefined variable:

  • 0

I have a “Notice: undefined variable” error that I cannot solve:

Notice: Undefined variable: Nom in C:\wamp\www\cible_envoi.php on line 22

Could you please have a look at the code below and explain me what’s wrong? Thanks!

cible_envoi.php:

<?php
try
{
    $bdd = new PDO('mysql:host=localhost;dbname=chansonniersduquebec.com', 'root', '');
}
catch (Exception $e)
{
    die('Erreur : ' . $e->getMessage());
}

$req = $bdd->prepare('INSERT INTO chansonniersduquebec.com (Nom) VALUES(?)');
$req->execute(array($_POST['Nom'])); // *** Line 22 ***

Incription.html:

<form id="Formulaire" name="Formulaire" method="post" action="cible_envoi.php">
  <label>
    <div align="center">Nom (votre nom d'artiste de préférence!)
      <span class="style1">*</span>
      <input type="text" name="Nom" id="Nom"/>
     </div>
     <p>&nbsp;</p>
   <label>
   ...
   <input type="submit" name="Soumettre" id="Soumettre" value="Soumettre" />
</form>
  • 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-12T18:10:58+00:00Added an answer on June 12, 2026 at 6:10 pm

    $bdd is out of scope.

         <?php
    //Try this
    
        try
         {
            $bdd = new PDO('mysql:host=localhost;dbname=chansonniersduquebec.com', 'root', '');
    
             // Insertion du message à l'aide d'une requête préparée
              $req = $bdd->prepare('INSERT INTO chansonniersduquebec.com (Nom) VALUES(?)');
    
              $req->bindParam(1, $nom);
    
              $nom = $_POST['Nom'];
    
              $req->execute();
          }
          catch (Exception $e)
          {
            die('Erreur : ' . $e->getMessage());
          }
    
    
    
      ?>
    

    or

    <?php
    //Try this
           $bdd = null;
        try
         {
            $bdd = new PDO('mysql:host=localhost;dbname=chansonniersduquebec.com', 'root', '');
    
          }
          catch (Exception $e)
          {
            die('Erreur : ' . $e->getMessage());
          }
    
    
    
             // Insertion du message à l'aide d'une requête préparée
              $req = $bdd->prepare('INSERT INTO chansonniersduquebec.com (Nom) VALUES(?)');
    
              $req->bindParam(1, $nom);
    
              $nom = $_POST['Nom'];
    
              $req->execute();
    
    
      ?>
    

    please, also make your input name and ID one word (Styles joués).

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

Sidebar

Related Questions

I have this error NOTICE: UNDEFINED VARIABLE: LOGO IN C:\WAMP\WWW\SITE\TOOLS\SMARTY\SYSPLUGINS\SMARTY_INTERNAL_DATA.PHP ON LINE 291 CALL
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” I have a member.php
Notice: You have an error in your SQL syntax; check the manual that corresponds
I have the following php errors : A PHP Error was encountered Severity: Notice
I have this error in CI: A PHP Error was encountered Severity: Notice Message:
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I am new to
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” Recently turned on errors
I'm using Drupal and I notice that if I have my CSS files aggregated
I have several older applications that throw a lot of xyz is undefined and
Lets say I have a variable $var that has not been defined. Why don't

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.