0

I want to make a page like this

http://agprotective.com.au/invoice/invoice.htm

There someone can add multiple date,site,start time, end time, hours amount by click the button + or can remove the row using - sign button. How can I get the value of that input in php? Normarlly we use $_POST['here-is-the-value-of-name-attribute-of-the-input-tag'];

But in the case http://agprotective.com.au/invoice/invoice.htm , I do not know what will be the value of the name attribute of the tag.

Can anyone tell me how to get the values of the dynamically generated (button generated) input tags and then send them to database.

0

1 Answer 1

2

The correct way to do this is simple:

<input name="myinput[]" />

PHP will then have:

$_POST['myinput'][0], $_POST['myinput'][1]...

The page you linked does it in a stupid manner, if I'm honest.

Sign up to request clarification or add additional context in comments.

3 Comments

-1 for being disrepectful +1 for being a correct answer nonetheless = 0
but in my case there could be multiple inputs and how i will now the number ?
count($_POST['myinput'])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.