PHP Show all data of a ROW in OPTION and INPUT

0

Since I'm creating a half-full project ...

I made a FORM where you have the < .OPTION. > and < .input. >

What I want is ... do a Loope where in that option it takes with it as POST the ID, NAME, EMAIL all of a so rows example.

nome | email| id
 1   |  @1  |  1
 2   |  @2  |  2
 3   |  @3  |  3 

  Se escolher esta <option>1</option>, ele posta tudo da row 1.

How do I do this? ... I'm lost.

I tried it like this, but it simply showed everything just 1 details in the row and the rest outside the row.

    while($row = mysqli_fetch_array($result2))
    { 
      echo "<option value = '".$row['id']."'>".$row['movie_name']."</option>";
      echo "</select>";
      echo "<input type='hidden' value='".$row['movie_name']."' name='movname'  hidden>";
      echo "<input type='hidden' value='".$row['movie_img']."' name='movimg'  hidden>";
    }

Simply grab all the ROW Values and bring along the chosen OPTION and prepare the POST and add everything ... how do I?

    
asked by anonymous 19.08.2017 / 23:56

1 answer

0

Seeing the author's comment:

....., I want this

<option value="'$row['id'] . $row['movie_name'] . $row['movie_img']'">'$row['movie_name']'</option>

so you can then ADD all other data to the other table.

We have to construct the inputs separated by a "separator". In the example below, the separator is a% com_of% but can be any that is not present in the query data.

echo "<option value=".$row['id'].",".$row['movie_name'].",".$row['movie_img'].">".$row['movie_name']."</option>";

If $ row ['id'] = , , $ row ['movie_name'] = 1 and $ row ['movie_img'] = Os dalmatas

the result of img1 is $_POST["nameSelect"]

From here on down is 1,Os dalmatas,img1 and explode

    
21.08.2017 / 19:01