Sorry I'm a bit of a noob when it comes to PHP but I just wondered if someone had an idea on how I could solve this PHP/SQL problem.
I have a PDO statement that gets all users from a database. With the array of users from the database I create a foreach loop to display all of the users in a table which I want to use to select a specific user, enter a number in the row of the user I select, then click submit and store the users name and also the number. I will use this information to populate another database later.
My question is, I cant seem to reference the user or the number in the table to extract the user and number I enter. When I try and request the numbered entered in the index.php, it will only ever display a number if I enter a number for a the final user in the table. When I try and view the FullName it never works and I get 'Undefined index: FullName' error. I also specified to 'POST in the form but it doesnt seem to be doing that. Does anyone have any ideas?
Thanks
//function.php
function getName($tableName, $conn)
{
    try {
        $result = $conn->query("SELECT * FROM $tableName");
                return ( $result->rowCount() > 0)
            ? $result
            : false;
    } catch(Exception $e) {
        return false;
    }
}
//form.php
<form action "index.php" method "POST" name='form1'>
  <table border="1" style="width:600px">
    <tr>
      <th>Name</th>
      <th>Number Entered</th>
    <tr/>
    <tr>
      <?php foreach($users as $user) : ?>
        <td width="30%" name="FullName">
          <?php echo $user['FullName']; ?>
        </td>
        <td width="30%">
          <input type="int" name="NumberedEntered">
        </td>
    </tr>
    <?php endforeach; ?>
  </table>
  <input type="submit" value="submit"></td>
</form>
//index.php
$users = getName('users', $conn);
if ( $_REQUEST['NumberedEntered']) {
    echo $_REQUEST['NumberedEntered'];
    echo $_REQUEST['FullName'];
}
 
     
    