Mysql
 sql >> Database >  >> RDS >> Mysql

Come ottenere l'ID di una query richiesta molto tempo fa e pubblicarla su un'altra tabella?

Aggiungi il campo nascosto:

su 1.php

echo '<form style="display:none;" name="answer_'.$index.'" method="post" action="output.php">'; // I dont think openning form from row to row would be nice!

echo '<input type="hidden" name="questionid" value="<?php echo $row[ID]?>"/>'

echo '<textarea  type="text" class="addtext" name="addtext" required id="addtext_'.$index.'" placeholder="Please type your answer here.."  ></textarea>';

echo '<button onClick="addsubmit('.$index.');" type="submit" id="addsubmit_'.$index.'" class="addsubmit"><B>Submit</B></button>';

echo '</form>';

a pagina 2.php

$qid = $_POST['questionid']; //get the question id and insert in the table