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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:41:33+00:00 2026-06-18T06:41:33+00:00

I have a simple form created, which allows the users to add and delete

  • 0

I have a simple form created, which allows the users to add and delete rows as they choose. After the user decides how many rows to add and populates the form accordingly, after submitting, I’d like to post the data so that I can use a .php script to upload the data onto a server.

I have tested the functionality of adding and deleting rows. When I click the submit button, it redirects me to upload.php, but at that page, I see an error: “Undefined index: reward” which makes me think that the data isn’t being sent properly.

Is there a problem with my implementation below?

HTML

<button onclick="addRow();">Add Row</button>
<form method="post" action="upload.php">
    <table border="1" id="optionsTable">
        <tr>
        <td>Header1</td>
        <td>Header2</td>
        <td>Delete</td>
        </tr>

        <tr id="templateRow" style="display:none">
        <td><input type="text" id="reward" /></td>
        <td><input type="text" id="duration" /></td>
    <td><input type="button" id="deleteOption" value="Delete"     onclick="delRow(this)"/></td>
        </tr>
    </table>

    <input type="submit" value="Submit" />
</form>

</body>
</html>

<script>
var maxID = 0;
function getTemplateRow() {
    var x = document.getElementById("templateRow").cloneNode(true);
    x.id = "";
    x.style.display = "";
    x.innerHTML = x.innerHTML.replace(/{id}/, ++maxID);
    return x;
}
function addRow() {
    var t = document.getElementById("optionsTable");
    var rows = t.getElementsByTagName("tr");
    var r = rows[rows.length - 1];
    r.parentNode.insertBefore(getTemplateRow(), r);
}
function delRow(row) {
    var i=row.parentNode.parentNode.rowIndex;
    document.getElementById('optionsTable').deleteRow(i);
}

</script>

I’m only debugging with upload.php right now so there is only one command there:
echo($_POST[‘reward’]);

Any help would be greatly appreciated.

  • 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-18T06:41:34+00:00Added an answer on June 18, 2026 at 6:41 am

    You need to define name for input.

    <input type="text" id="reward" />
    

    TO

    <input type="text" id="reward" name="reward"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which allows users to comment on a page, however they
I have a simple page which allows users to add language ids to items.
I have a form that allows the user to add or remove users from
I have created a simple form which is loading a csv file with few
I have a form which has two inputs. The first input allows a user
I am a bit confused. I have created a simple form with a one
I have created a simple test form with FormBorderStyle = FixedToolWindow by default and
I have created a simple web app/form using google app engine. the site is
I have simple form like this which accepts only two values string action and
I have this simple form which shows a pop up calendar when clicked on

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.