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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:10:30+00:00 2026-06-11T14:10:30+00:00

I try to create a query getting from a formular through post function. The

  • 0

I try to create a query getting from a formular through post function. The post function must pass a text and an int variable to create the query sent to database.

When I start execute my php script, it says: undefined index, for the int variable.

I dont understand why the int variable isn’t recognized. here is my code:

formulaire04.php

<form action="selection_jeux.php" method="post">
    <p>
    Nom
    <input type="text" name="possesseur"/>
        Prix maximum
    <input type="int" name="prixmax"/>
    <input type="submit" value="Valider"/>
    </p>
</form>

selection_jeux.php

<?php
    try
    {
        $bdd = new PDO('mysql:host=localhost;dbname=test' , 'root', '');
    }
    catch(Exception $e)
    {
        die('Erreur : '.$e->getMessage());
    }
    $req = $bdd->prepare('SELECT nomselec, prix FROM jeux_video WHERE possesseur = :possesseur AND prix <= :prixmax');
    $req->execute(array('possesseur'=> $_POST['possesseur'], 'prixmax'=> $_POST['prixmax']));

    echo '<ul>';

    while($donnees = $req->fetch())
    {
        echo '<li>'  . $donnees['nom'] . ' (' . $donnees['prix'] . ' EUR)</li>'; 
    }
    echo '<li>';

    $req->closeCursor();
?>
  • 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-11T14:10:32+00:00Added an answer on June 11, 2026 at 2:10 pm

    The issue is in the SQL Statement not the HTML markup

    On your prepare statement you have SELECT nomselec,prix
    but on your while statement you have $donnees[‘nom’] not nomselec

    Could that be the issue?

    To all the people saying int isn’t a valid type, this does not matter it still gets posted as normal;

    Example:

    <?php
    if(isset($_POST))
    {
        print_r($_POST);
    }
    ?>
    <form action="" method="post">
    <p>
    Nom
    <input type="text" name="possesseur"/>
    Prix maximum
    <input type="int" name="prixmax"/>
    <input type="submit" value="Valider"/>
    </p>
    </form>
    

    Returns:

    Array ( [possesseur] => test [prixmax] => 123 )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to create a gql query through my browser dashboard to easily look
I am trying to read in a text file from an SQL query (SQL
When I try to create indexed view I am getting an error datepart returns
I'm getting my xml file as a result of a php query from some
string query = select * from cfo_daily_trans_hist; try { using (SqlConnection connection = new
Getting this error when I try to run this script. I'm creating the function
I try create a map for open ~/.vimrc, but open the ~/.vimrc only when
I want to try create something like Zend's Server Pagecache. What I want to
I try to create donate via PayPal button and add custom select with amount.
I try to create styles with first-child and last-child items but I encountered a

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.