Note that there are some explanatory texts on larger screens.

plurals
  1. POApprove submitted data by admin in php
    text
    copied!<p>There is registration form in which country field is there.if user's country is not in drop down list. user can select other at that time display one textbox and user enter their country in textbox.after submit country by user .how to approve the requested country and publish in country drop down list in php.</p> <p><strong>config.php</strong></p> <pre><code>&lt;?php $con=mysql_connect("localhost","root",""); if(!$con) { die("Could not connect".mysql_error()); } mysql_select_db("RateMyProfessor",$con); ?&gt; </code></pre> <p><strong>Demo.php</strong></p> <pre><code> &lt;?php include ("config.php"); $query = "select * from user_details where is_approved='0'"; $result=mysql_query($query); $i = 1; //counter for the checkboxes so that each has a unique name echo "&lt;form action='process.php' method='post'&gt;"; //form started here echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;UserId&lt;/th&gt; &lt;th&gt;Email&lt;/th&gt; &lt;th&gt;Country &lt;/th&gt; &lt;th&gt;Update&lt;/th&gt; &lt;/tr&gt;"; while($row = mysql_fetch_array($result)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['UserId'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Email'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Country'] . "&lt;/td&gt;"; echo "&lt;td&gt;&lt;input type='checkbox' name='check[$i]' value='".$row['UserId']."'/&gt;"; echo "&lt;/tr&gt;"; $i++; } echo "&lt;/table&gt;"; echo "&lt;input type='submit' name='approve' value='approve'/&gt;"; echo "&lt;/form&gt;"; mysql_close($con); ?&gt; </code></pre> <p><strong>process.php</strong></p> <pre><code>&lt;?php include_once("config.php"); if(isset($_POST['approve'])) { if(isset($_POST['check'])) { foreach ($_POST['check'] as $value){ echo $value; $sql = "update user_details set is_approved ='1' where UserId = '$value'"; mysql_query($sql) or die (mysql_error()); } } } ?&gt; </code></pre> <p>when admin is approve country from admin side country is copy on country table.</p>
 

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