I have a php for loop and inside the php for loop there is a button element inside a td tag. I am passing button Id from one page to another using query String.
page 1:
$id = $data['no'];
<td><button class="btn btn-primary btn-small"><a href="votingPoll.php?'.$str.'">SUBMIT</a></button></td>
To get the value of the button id i have this code in page 2:
$id = $_GET['str'];
but for some reason it's giving me a error of undefined variable 'str' on page 2.
asked Feb 12, 2018 at 21:43
1 Answer 1
change your code to:
<td><button class="btn btn-primary btn-small"><a href="votingPoll.php?id='.$id .'">SUBMIT</a></button></td>
on yourpage.php or whichever file you would like to recieve the data, access it with $_GET['id']
answered Feb 12, 2018 at 21:46
lang-php
var_dump($str);
and update your question with the output.