Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your question wasn't clear.. For example, the data of our tables are:</p> <pre><code>recipients | recipients_banned recipient_id | member_id | recipient_id | member_id ------------------------ | ------------------------ 1 | 21 | 2 | 22 | </code></pre> <p>If you just want to have <em>"Yes"</em> and <em>"No"</em> radio buttons on a form that when you've selected the <em>"Yes"</em> button and then submitted, all the data in <strong>recipients</strong> table will be moved into the <strong>recipients_banned</strong> table, then you should better try this code. For example we've a PHP file named as <em>form.php</em>:</p> <pre><code>&lt;form action="form.php" method="get"&gt; &lt;input type="radio" name="q" value="1"&gt;Yes&lt;br /&gt; &lt;input type="radio" name="q" value="0"&gt;No &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; &lt;?php $con = mysqli_connect("$host", "$user", "$password", "$database"); $q = $_GET["q"]; if ($q == 1) { $i = "INSERT INTO `recipients_banned` ( `recipient_id` , `member_id` ) SELECT recipient_id , member_id FROM `recipients`;"; $d = "DELETE FROM `recipients`;"; mysqli_query($con, "$i $d"); echo '"recipients" data is moved to "recipients_banned"!'; } else if ($q == 0) { echo "Nothing is moved!"; } mysqli_close($con); ?&gt; </code></pre> <p>If you select <em>"No"</em> and then submit it, the output will be <em>"Nothing is moved!"</em>. But if you select <em>"Yes"</em> before submitting it, the database tables result which is unseen will become as the tables below with an output of <i>'"recipients" data is moved to "recipients_banned"!'</i>:</p> <pre><code>recipients | recipients_banned recipient_id | member_id | recipient_id | member_id ------------------------ | ------------------------ | 1 | 21 | 2 | 22 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload