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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:25:02+00:00 2026-06-17T18:25:02+00:00

I have a program that uploads a .csv file of golf scores. upon upload

  • 0

I have a program that uploads a .csv file of golf scores. upon upload the data from the file is diplayed in the form of a html table in the browser. the code for this is shown below.

echo '<div class="tablediv"><table><form method="post" action="new.php" >';


while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        if($ctr ==1)
        {
        echo '<tr>';
        echo "<th>" . $data[3] . "</th><th>" .  $data[4] .
        "</th><th>  " .     $data[5] . "</th><th> " . $data[6].
        "</th><th>" . $data[7] ."</th><th> Prize </th>" ;
        echo '</tr>';
        $ctr++ ;
        }
        else if ($ctr > 1) 
        {
        echo '<tr>';
        echo "<td>" .$data[9] . "</td><td>" .  $data[10] .
       "</td><td>" . $data[11] . "</td><td>  " . $data[12]. "</td><td>" . $data[13] . "</td><td><select name='dropdown'>
        <option value='empty'>None Allocated</option>
        <option value='firstprize'>First Prize</option>
        <option value='secondprize'>Second Prize</option>
        <option value='thirdprize'>Third Prize</option>
        </select></td>";
        echo '</tr>';
        }

    }
    echo '<input type="submit" name="submit" value="Submit" class="submit1" /></form></table></div></br>';

fclose($handle);
}

once a user has uploaded the file and it is diplayed I want the user to be able to allocate a prize via the dropdown list and then, once this is done the data can be commited to a database. what i need to do is basically get the selected prize position also and commit that to the database along with the other data. im just not too sure how to get at the selected value in the dropdown list. would the best way to do this be to use PHP simple HTML DOM parser? or does anyone know of an easier way. Thanks a lot for your help in advance!

the initial upload of the file looks like below. last column being the dropdownlist

 Player name    H'cap   Score   Front   Back    Prize
 name           18        66    33.0    33.0    none allocated
 name           11        67    33.5    33.5    none allocated
 name           4         67    33.0    34.0    none allocated
 name           12        67    31.0    36.0    none allocated
 name           11        68    34.5    33.5    none allocated
 name           6         68    34.0    34.0    none allocated
 name           19        68    31.5    36.5    none allocated
 name           11        69    36.5    32.5    none allocated
 name           11        69    33.5    35.5    none allocated
  • 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-17T18:25:04+00:00Added an answer on June 17, 2026 at 6:25 pm

    my solution was this. this way i can get the post data on the new.php page by using var_dump($_POST). I create another counter “$counter2″ and initialize it to 1. then in append the counter to the dropdownlist name ” and var_dump($_POST) gives me an output like
    this

     array(76) { ["dropdown1"]=> string(11) "secondprize"    
     ["dropdown2"]=> string(5) "empty" ["dropdown3"]=> string(10) "firstprize" 
     ["dropdown4"]=> string(5) "empty" ["dropdown5"]=> string(5) "empty"
    

    here are the changes i made to the function.

        if ($this->fileerror > 0) {
        echo "Error: " . $this->fileerror . "<br />"; 
    }else{ 
    if (($handle = fopen($this->filetemp, "r")) !== FALSE) {
        $ctr = 1; // used to exclude the CSV header
                $count2 = 1;        
        echo '<div class="tablediv"><table><form method="post" action="new.php" >';
    
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            if($ctr ==1)
            {
    
            echo '<tr>';
            echo "<th>" . $data[3] . "</th><th>" .  $data[4] . "</th><th>  " . $data[5] . "</th><th> " . $data[6]. "</th><th>" . $data[7] ."</th><th> Prize </th>" ;
            echo '</tr>';
            $ctr++ ;
            }
            else if ($ctr > 1) 
            {
            echo '<tr>';
            echo "<td>" .$data[9] . "</td><td>" .  $data[10] . "</td><td>" . $data[11] . "</td><td>  " . $data[12]. "</td><td>" . $data[13] . "</td><td><select name='dropdown" .  $count2."'>
            <option value='empty'>None Allocated</option>
            <option value='firstprize'>First Prize</option>
            <option value='secondprize'>Second Prize</option>
            <option value='thirdprize'>Third Prize</option>
            </select></td>";
            echo '</tr>';
            $count2++;
            }
    
        }
        echo '</br><input type="submit" name="submit" value="Submit" /></form></table></div></br>';
    
    fclose($handle);
    }
    

    this is a pretty sloppy solution i know. so any other solutions you may have for this would be appreciated. thanks.

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

Sidebar

Related Questions

I have a program that reads from a file that grabs 4 bytes from
I have a program written in python that uploads an archive (zip file) to
I've got a program that reads and sorts information from a CSV file but
I have a Java program that calculates some stats daily and uploads the file
I have to create a program that would upload business data to the FTP
I have the following form with javascript that uploads a file to a server
I have been making a program that creates multiple CSV's from another source CSV
I have a program that gets a JSON from the server using getJSON and
I have a JSP file where the form field will uploads a file to
I have a feature of my program where the user can upload a csv

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.