Hello, I have been beating my head over this issue for almost a week now. I have my pages setup to where the user can register and I can display these members.

Here is where it gets fun. Where the applicants are display they are in the rows so that admins can view them all as we manually need to accept each member. Each row has an approve or deny button. When approved is pressed it takes you to a page where you can review and see 3 choices they made and select 1 of them for what training path they go on, update their permissions give them their password and userID as well as move this info to another table. On the other button it simply allows admins to either delete or ban.

I could use some help on how to do this. I have the pages laid out but cannot pass the displayed data from pending apps to their appropriate approve or deny pages. Thanks in advance for any help. Below is what I have to display and it works just fine. Just adding in I need to add code to this.

<?php require_once('../Connections/DB'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_rougueDB, $rougueDB);
$query_Apps = "SELECT Name, Age, email, VID, version, choice1, choice2, home, choice3, resume, Applicant FROM table WHERE Applicant = 'y'";
$Apps = mysql_query($query_Apps, $DB) or die(mysql_error());
$row_Apps = mysql_fetch_assoc($Apps);
$totalRows_Apps = mysql_num_rows($Apps);
?>

					
<table border="2">
  <tr>
    <td>Name</td>
    <td>Age</td>
    <td>email</td>
    <td>VID</td>
    <td>Version</td>
    <td> Selection 1</td>
    <td> Selection 2</td>
    <td> Selection 3</td>
    <td>Location</td>
    <td>resume</td>
  </tr>
  <?php do { ?>
  <tr>
  
    <td><?php echo $row_Apps['Name']; ?></td>
   
    <td><?php echo $row_Apps['Age']; ?></td>
    <td><?php echo $row_Apps['email']; ?></td>
    <td><?php echo $row_Apps['VID']; ?></td>
    <td><?php echo $row_Apps['version']; ?></td>
    <td><?php echo $row_Apps['choice1']; ?></td>
    <td><?php echo $row_Apps['choice2']; ?></td>
    <td><?php echo $row_Apps['choice3']; ?></td>
    <td><?php echo $row_Apps['home']; ?></td>
    <td><?php echo $row_Apps['resume']; ?></td>
   <form action="approved.php" method="post"> <td><input type="submit" value="Approve" </td></form>
    <form action="denial.php" method="post"><td><input type="submit" value="Deny" </td></form>
  </tr>
   
  <?php } while ($row_Apps = mysql_fetch_assoc($Apps)); ?>
</table>
<?php
mysql_free_result($Apps);
?></p>
				</div>
			</div>
		</div>

Recommended Answers

All 15 Replies

Let us talk about basics.

You need to display "NAME" but, all I see is it simple <?php echo $row_Apps[array]; ?> in <td>

every input requires a "name" which you then, fetch using $_POST

Hope it helps :)

if your approved and denial pages are secure admin pages, you could potentially do it as $_GET requests.

Instead of:

<form action="approved.php" method="post"> <td><input type="submit" value="Approve" </td></form>
<form action="denial.php" method="post"><td><input type="submit" value="Deny" </td></form>

Go with:

<td><a href="approved.php?name=<?php echo $row_Apps; ?>&age=<?php echo $row_Apps; ?>&<<<< AND SO ON FOR ALL VALUES >>>>>">APPROVE</a></td>
<td><a href="denial.php">DENY</a></td>

Then on the approved.php page, just pull the values from the url and do what you need to with em:

$name = $_GET;
$age = $_GET;
and so on..

I do thank you for the advice but for some reason it isnt working. I even tried to just simply echo out the "name" variable and no information is displayed.

your URL of the approved.php page... does it show like this:

approved.php?name=John&age=24&email=john@smith.com...

OR

approved.php?name=&age=&email=...

approved.php?name=&age=&email=...

I know im missing something simple here. :)

Just an update I just redid it and it does show like this

approved.php?name=table%20test&airframe1=Bomber%20GSC%20&airframe2=Bomber%20GSC&airframe3=Bomber%20GSC

Where Bomber is the choice the user made

right, now on that page, if you $_GET those values, you should have them to do whatever you want to with em, like insert them in database

$name      = $_GET['name'];  // This should give you "table test" as per the example url
$airframe1 = $_GET['airframe1']; // This should give you "Bomber GSC " as per above example
.. and so on

Thats what I have. Yet if I echo $name nothing is displayed. Do I need to be useing session or is automatic. Also as it is right now i dont have it secured or anything, this isnt required to do that is it?

Well this sounds like an administrative function, so at the minimum, as long as you have that page behind a password, it should suffice. And no, sessions are not required with GET and POST.

Post your code for the approved.php page here

<?php include 'includes/document_head.php'?>
		<div id="wrapper">
			<?php include 'includes/topbar.php'?>		
			<?php include 'includes/sidebar.php'?>
			<div id="main_container" class="main_container container_16 clearfix">
				<?php include 'includes/navigation.php'?>	
				
				
			  <div class="flat_area grid_10">
					<h2>Welcome to <strong>your Portal</strong></h2>
					<p><strong>You have 0 currency requirements upcoming due!</strong><strong></strong></p>
				</div>				
			</div>
		<div id="wrapper">	
			<?php include 'includes/topbar.php'?>		
			<?php include 'includes/sidebar.php'?>
			<div id="main_container" class="main_container container_16 clearfix">
				<?php include 'includes/navigation.php'?>
				<div class="flat_area ">
					<h2>Empty Page <small>(A good starting point)</small></h2>
					<p>
                    <?php 
					
					$name =$_GET['Name'];
					$airframe1 = $_GET['airframe1'];
					echo $name ;
					
					
					
					 ?>
                  </p>
				</div>
			</div>
		</div>

I really do all the help this far.

You have a typo:

$name =$_GET['Name'];

should be

$name = $_GET['name']; // lower case 'name' instead of camel case 'Name'
commented: Know how to solve the issue and was very patient with me. +1

Un real that was it, for some reason I was thinking it had to be a capital since that is how i had it name prior. now can can I take the 3 choices place them in a drop down list and select one of them to update a table using a form for example?
I can thank you enough and you have left a great impression of yourself and this website and I will be coming here as need be. Thanks alot my friend!!!!

Anytime man :) You can thank me by giving me some positive rep ;)

By three choices, do you mean the three air frames?

yes the 3. and you get kudos from me.

$airframe1 = $_GET['airframe1'];
$airframe2 = $_GET['airframe2'];
$airframe3 = $_GET['airframe3'];

echo "<form action='' method='post'>
        <select name='airframe'>
          <option value='".$airframe1."'>".$airframe1."</option>
          <option value='".$airframe2."'>".$airframe2."</option>
          <option value='".$airframe3."'>".$airframe3."</option>
        </select>
      </form>";

That'll give you your drop down menu with the three choices. Have fun!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.