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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:04:19+00:00 2026-06-05T04:04:19+00:00

I have a form where names from a SQL-database are listed. After each name

  • 0

I have a form where names from a SQL-database are listed. After each name there is a textfield for a grade. I want the grades and names to be saved in arrays. It already works with the names, but the array for the grades just gets filled with the content in the last textfield.

$Requete  = "SELECT `vorname`, `nachname` FROM `lernende`";
    $Result   = mysql_query($Requete,$db);
    $grade     = array();
    $vorname  = array();
    $nachname = array();
    $counter  = 0;

while($row = mysql_fetch_array($Result))
    {

        echo '<p>', $row["vorname"]," ", $row["nachname"], " ", '<label>Note: <input type="text" name="note"/></label></p>';
        $grade[$counter] = $_POST['note'];
        $vorname[$counter]    = $row["vorname"];
        $nachname[$counter]    = $row["nachname"];
        $counter = $counter + 1;

    }

What is wrong with my code? I’ve just started learning php and have no idea how to solve this…

  • 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-05T04:04:20+00:00Added an answer on June 5, 2026 at 4:04 am

    You hvae to change this line of code:

    echo '<p>', $row["vorname"]," ", $row["nachname"], " ", '<label for="note-'.$counter.'">Note:</label> <input id="note-'.$counter.'" type="text" name="note[]"/></label></p>';
    

    However, your code is not the finest I’d say. Start learning working with arrays as shown on http://php.net/array and start with clean HTML as described at http://de.selfhtml.org/ (since you are German speaking).

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

Sidebar

Related Questions

I have a form with a name and an email address. I want a
I want to filter out duplicate customer names from a database. A single customer
I have a form that has all the fields pulled dynamic from a database
I have one SQL server database which was created using Import/Export Wizard from an
I have a form where users can enter the names and emails addresses of
Im using c# .net windows form application. I have loaded names of all the
I have a form with Name textbox Address textbox Phone textbox Insert buttion and
I need some help with something... say I have the following form... <form name=
I have a form where the name attributes get updated , but the problem
I have two form fields First name and Last name I can also clone

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.