How to take part of the text of a form to send to a table

Asked

Viewed 31 times

0

I have a form that after being processed generates an excel file with the data of this form using $_POST to get the values.

I need a way to get the name that appears on the side of each input to send in excel as well. below how are the inputs

<div>
 <input type="number" value="5" name="form[p1]" id="p1" > Produto A
</div>
<div>
 <input type="number" value="0" name="form[p2]" id="p2" > Produto B
</div>

The input ids range from P1 to p77. I have a php function that brings me only inputs with values other than "0".

Is there any way to make him take the product name (Product A, for example)?

So I can generate in excel (table converted to excel) like this:

<td>5</td><td>Produto A</td>

I did using a MYSQL query taking the input id and transferring the name and it brings the name right, the problem is that when finishing sending the email, gives an error on the page: ERR_INVALID_RESPONSE

When I do without MYSQL query it does not give error

  • https://answall.com/questions/163557/pegar-o-texto-entre-uma-tag/163561#163561

  • No way. You must submit the product name in $_POST to capture it in the script. If I understand the question.

  • There are resources to do this, but then you’ll have to touch some jQuery in your code. The idea was to send in value of each input something like this: value="5_Produto A". When you give Submit, PHP will separate the product name number and make the application.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.