Search within a _POST

Asked

Viewed 43 times

0

I was wondering if there is a way to search for data inside a POST? I need it a lot, because each box is a different id. Example:

    **JS:** 
data {'id':id, 'ponto1':ponto1}
    **AJAX:**
id: $id = isset($_GET['id']);
$ponto = isset($_POST['ponto".$id."']);
  • that question makes no sense

  • Yes, please make an effort to help me.

  • what do you mean search for data within a post? exemplifies this

  • In ajax when you are going to post, have the search data from another page by the right js? in case it is the id and the point. But on the page, each input with name="dot" has an id, e.g.: name="point1", name="point2" I wanted it to be like this in the post point in ajax, so I could look up what kind of point it is.

  • I’m sorry but your example doesn’t make sense, rephrase your question with data Exmplos you want to send and take...

1 answer

1


What you can do is pass like this (I’ll show you the HTML input to understand)

Since each point has an id you can do so:

you create a Hidden field:

<input type="hidden" name="id[]" value="Aqui colocas o teu id"/>

<input type="text" name="post[ID Aqui tm]" />

in php like this:

$ArrayComId = $_POST['id[]'];

$ArrayComPost = $_POST['Post[]'];

then just do a foreach and take the post of each ID

foreach($arraycomid as $key => $value)
{
  echo $arraycompost[$value];
}

It is possible to have some error but the logic is +/- this

  • Now you only need to make an Ajax request to your php with the data in body

  • IT WORKED!!!! Thank you very much!!!

Browser other questions tagged

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