Getting name from Submit Button php -


basically making list of buttons , want single $_post['submit'] delete database depending on button pressed. there 2 values keep within submit button. thanks!

...while($row = mysqli_fetch_array($papertoreview)){              if ($row > 0) {              echo '<td width = 200><input type=submit name=' . $row['uid'] . 'value=removerow />';         echo '</tr>'; }} if (isset($_post['submit']) && $_post['submit'] =='removerow'){      dbsubmit("delete paper_review paper_reviewer_id = '" ???submit button name???"' , paperid = '"???some other part of submit button"'"); 

you can't pass 2 values through $_post variable 1 form element. unless put them in value attribute, use php explode split values.

in html form have

<input type="submit" name="btnsubmit" value="valuea-valueb" /> 

then in php script

$data = explode('-', $_post['btnsubmit']); 

now data array split data ($data[0] = 'valuea', $data[1]= 'valueb')

also, did not close <td> tag in loop, did mean </td> in second echo? , width attribute not enclosed quotation marks, , deprecated.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -