0
<?php
$dbc=mysqli_connect('localhost','root','','nog') or die('Not Connected');
$query="select * from registration";
$result=mysqli_query($dbc,$query) or die('Not Connect');

if ($result) {

  // create a new form and then put the results
  // indto a table.
  echo "<html>
        <body>";
  echo "<form method='post' action='approve.php'>";
  echo "<table cellspacing='0' cellpadding='15'>

        <th width='15%'>User Id</th>
        <th width='55%'>Name</th>
        <th width='15%'>Age</th>
        <th width='15%'>Blood Group</th>
        <th width='15%'>Sex</th>
        <th width='15%'>Qualification</th>
        <th width='15%'>E-Mail</th>
        <th width='15%'>Address</th>
        <th width='15%'>About Yourself</th>
        <th width='15%'>Status</th>
        ";


  while ($row = $result->fetch_object()) {

        $UserId = $row->UserId;
        $Name = $row->Name;
        $Age = $row->Age;
        $BloodGroup= $row->BloodGroup;
        $Sex = $row->Sex;
        $Qualification = $row->Qualification;
        $Email = $row->Email;
        $Address = $row->Address;
        $AboutYourself = $row->AboutYourself;
        $Status = $row->Flag;

        //put each record into a new table row with a checkbox
    echo "<tr>

            <td>$UserId</td><td>$Name</td><td>$Age</td><td>$BloodGroup</td><td>$Sex</td><td>$Qualification</td><td>$Email</td><td>$Address</td><td>$AboutYourself</td><td>$Status</td>
            <td><input type='checkbox' name='checkbox[]' id='checkbox[]'  value=$UserId /></td>
         </tr>"; 

    }

    // when the loop is complete, close off the list.
    echo "</table><p><input type='submit' class='button' name='Approve' value='Approve'/></p>";
    //echo "<a href='reject.php'><input type='submit' value='Reject' name='register'/></a>";
    echo "</html>
</body>";
}

?>

I want to add a "Reject Button on this form which redirect to "reject.php".
But I don't know how I do it.......
Anyone plz help me....

Edited by Dani: Formatting fixed

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ankit.pandey3
0
[code=php]


<?php
$dbc=mysqli_connect('localhost','root','','nog') or die('Not Connected');
$query="select * from registration";
$result=mysqli_query($dbc,$query) or die('Not Connect');

if ($result) {
  
  // create a new form and then put the results
  // indto a table.
  echo "<html>
		<body>";
  echo "<form method='post' action='approve.php'>"; 
  echo "<table cellspacing='0' cellpadding='15'>
  		
  		<th width='15%'>User Id</th>
  		<th width='55%'>Name</th>
		<th width='15%'>Age</th>
		<th width='15%'>Blood Group</th>
		<th width='15%'>Sex</th>
		<th width='15%'>Qualification</th>
		<th width='15%'>E-Mail</th>
		<th width='15%'>Address</th>
		<th width='15%'>About Yourself</th>
		<th width='15%'>Status</th>
		";
	
	
  while ($row = $result->fetch_object()) {
	
		$UserId = $row->UserId;
		$Name = $row->Name;
		$Age = $row->Age;
		$BloodGroup= $row->BloodGroup;
		$Sex = $row->Sex;
		$Qualification = $row->Qualification;
		$Email = $row->Email;
		$Address = $row->Address;
		$AboutYourself = $row->AboutYourself;
		$Status = $row->Flag;

		//put each record into a new table row with a checkbox
	echo "<tr>
			
			<td>$UserId</td><td>$Name</td><td>$Age</td><td>$BloodGroup</td><td>$Sex</td><td>$Qualification</td><td>$Email</td><td>$Address</td><td>$AboutYourself</td><td>$Status</td>
			<td><input type='checkbox' name='checkbox[]' id='checkbox[]'  value=$UserId /></td>
		 </tr>"; 
	
    }
	
	// when the loop is complete, close off the list.
	
	//echo "<a href='reject.php'><input type='submit' value='Reject' name='register'/></a>";
	echo "</html>
</body>";
}





I want to add a "Reject Button on this form which redirect to "reject.php".
But I don't know how I do it.......
Anyone plz help me....

?>

Hmm..I already see a commented out link at the bottom of your code that would do this, but if you want it done with button here is how:

Add a button like this to desired place:

<input type='submit' class='button' name='Reject' value='Reject'/>

and at the very top of your code add this (but at the top, above everything else)

if (isset($_POST['Reject']))
{
// put redirection code here - it can be something like this:
header('Location: http://www.example.com/reject.php');
}
0

On add this on the top it's not working bcoz which values we have to reject declares in checkboxes which is below this code.
We have to take the value of checkboxes eithe rapproval or rejection case....
Any Solution???????????

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.