Good day all!
I have been working on a project that requires me to to the following:
Select a user from a list, on submit go to next page.
The next page contains the session variable $id of the selected user.
On this page, I am assigning menu permissions. I have a repeating row from a recordset and I am getting the values for insertion or update from the form correctly on insert/update, but I can't seem to get the select box "menuassignment[]" to show the users input on error checking. I think it has something to do with how I am going about getting the array values, but have not been able to get it to work.
Here is the code for the page:

/////////////////////////////
  $expected = array('menuassignment');

$missing = array();
  // assume that there is nothing suspect
  $suspect = false;
/////////////////////////////////////

$AddData="no";
$warnstart="no";
$MM_flag="MM_insert";
if((isset($_POST["Submit"])) && ($_POST["MM_insert"] == "access1")) {
	$AddData="yes";
	$warnstart="no";
if (!$_POST['restrict']) 
	{ 
	$AddData = "no";
	?>
	<?php
 if ($warnstart=="no") { ?>
	<div class="warningstart">Please complete the missing item(s) indicated. </div>
		<?php
		}
		$warnstart="yes";
		if (!$_POST['restrict']) { ?> <div class="warning"><li>Please set the Restrict Record Edit Options</li></div>
		<?php }	
} 
for($i=0;$i<count($_POST['menuname']);$i++)
		{
		$assigned=$_POST['menuassignment'][$i];
		$MName=$_POST['menuname'][$i];
		$id=$_SESSION['mambo_user_id'];
		   ///echo out error message
		if ($assigned =="")
		{
		$AddData = "no";
		if ($warnstart=="no") 
		{ ?>
		<div class="warningstart">Please complete the missing item(s) indicated. </div>
		<?php
		}
		$warnstart="yes";?> 
		<div class="warning"><li>Please set the Menu Assignment Options for <? echo $MName; ?> Menu</li></div>
		<?php //} 
		} 
		}
		if ($warnstart=="yes") 
		{ ?>
		<div class="warningend"></div>
		<?php 
		} 
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
if((isset($_POST["Submit"])) && ($_POST["MM_insert"] == "access1") && $AddData=="yes" && isset($_POST['menuname'])) 
{

$updateApps= sprintf("UPDATE `skills_access` SET `restrict`=%s WHERE `mambo_user_id`=%s AND `skills_access_id`=%s ",
                       GetSQLValueString($restrict, "text"),
                       GetSQLValueString($mambo_user_id, "text"),
                       GetSQLValueString($AccessID, "text"));
			
  	mysql_select_db($database_training, $training);
	 $result2 = mysql_query($updateApps, $training) or die(mysql_error());

	if((isset($_POST['menuname']))|| (isset($_POST['menuassignment']))|| (isset($_POST['id']))|| (isset($_POST['username']))) 
		{
		for($i=0;$i<count($_POST['menuname']);$i++)
			{
			$assigned=$_POST['menuassignment'][$i];
			$MName=$_POST['menuname'][$i];
			//$id=$_POST['mambo_user_id'];
			$menu=$_POST['menu'][$i];
			$username = $row_rsUser['username'];
//insert statement goes here
$insertApps = "INSERT INTO assignedmenu(`username`, `mambo_user_id`, `Access`, `menuname`, `MenuID`)  VALUES('$username', '$id', '$assigned','$MName', $menu)";
             $result1 = mysql_query($insertApps) or die(mysql_error());
		}
	}
///////////////////////	
  if ($suspect) {
    //$mailSent = false;
	unset($missing);
	}
  else {
    // process the $_POST variables
    foreach ($_POST as $key => $value) {
      // assign to temporary variable and strip whitespace if not an array
      $temp = is_array($value) ? $value : trim($value);
	  // if empty and required, add to $missing array
	  if (empty($temp) && in_array($key, $required)) {
	    array_push($missing, $key);
	    }
	  // otherwise, assign to a variable of the same name as $key
	  elseif (in_array($key, $expected)) {
	    ${$key} = $temp;
	    }
	  }
	}


  if (!$suspect && empty($missing)) {
    // set default values for variables that might not exist
	
	$menuassignment = isset($menuassignment) ? $menuassignment : array('None selected');
	}
///////////////////////////	
// here put the insertgoto page
  //$insertGoTo = "access2.php";
  //header(sprintf("Location: %s", $insertGoTo));
}
?>
Here is the form:
<? $_SESSION['AccessID']; ?>
<form id="access1" name="access1" method="POST" >

  <table width="550" border="1" bordercolor="#000066">
    <tr>
      <td colspan="2" scope="row"><div align="center"><strong>Training Database Menu Security &amp; Restrict Record Edit </strong></div></td>
    </tr>
    <tr>
      <td colspan="2" scope="row"><div align="left"><b>
          <?php echo $row_rsUser['username']; ?>	   
<input name="username" type="hidden" value="<? echo $row_rsUser['username'] ; ?>" />
<input name="id[]" type="hidden" value="<? echo $_SESSION['mambo_user_id']; ?>">
<input name="skill_access_id" type="hidden" value="<? echo $_SESSION['AccessID']; ?>" />
    </div></td>
    </tr>
    <tr>
      <td width="218" valign="middle" scope="row"><? echo $var; ?></td>
      <td width="316" valign="middle" scope="row">Restrict Record Edit?
<?php 
// initialize or capture variable 
$XX = !isset($_POST['restrict'])? NULL : $_POST['restrict']; 
?> 
<select name="restrict">
<option value="<?php echo $XX;?>" SELECTED><?php echo $XX;?></option> 
<option value="Yes">Yes</option> 
<option value="No">No</option> 
</select>
 </td>
 </tr>
<tr>
      <td height="46" colspan="2" valign="middle" scope="row"><div align="center"><span class="style1"><em>Please indicate which menus the user will have access to</em>. </span></div></td>
    </tr>
  </table> 
  <table width="550" border="1" bordercolor="#00066">
   
      <?php do { ?>
	  <tr>
        <td width="227" valign="middle" scope="row"><B>
          <input name="menu[]" type="hidden" id="menu[]" value="<?php echo $row_rsMenu['MenuID']; ?>" />
         <?php echo $row_rsMenu['menuname']; ?>
		  <input name="menuname[]" type="hidden" value="<? echo $row_rsMenu['menuname'] ; ?>" />
        </B></td>
<td>
///////////////////////////////////////////////////////////////////////////////////////////////////////
as you can see by the commented out code, I have tried to get this to work on several ways. All I want to do here is :
if the user hits submit and has not filled out the form properly, I want the users initial selected values retained for output to the screen.
 
///////////////////////////////////////////////////////////////////////////////////////////////////
<? //for($i=2;$i<count($_POST['menu']);$i++)
//{
//$menuassignment= array();
//foreach ($menuassignment as $item)
//{
//echo "the values of menuassignment are '".$item."'<br/>";
//}
//$menuassignment=$_POST['menuassignment'][$i]; ?>
	<select name="menuassignment[]">
	<option value=""
	<?php
	$OK = isset($_POST['menuassignment']) ? true : false;
	if ($OK && isset($missing) && in_array('', $_POST['menuassignment'])) { ?>
	selected="selected"
	<?php } ?>></option>
<option value="Yes"<?php if ($OK && isset($missing) && in_array('Yes', $_POST['menuassignment'])) { ?>
selected="selected"<?php } ?>>Yes</option>
<option value="No"<?php  if ($OK && isset($missing) && in_array('No', $_POST['menuassignment'])) { ?>selected="selected"<?php } ?>>No</option>
		</select>
<? //} ?>
</tr>
<?php } while ($row_rsMenu = mysql_fetch_assoc($rsMenu)); ?>
      <tr>
        <td colspan="2" valign="middle" scope="row"><div align="center">
          <input name="Submit" type="Submit" id="Submit" value="Submit" />
        &nbsp;&nbsp;<input type="button" name="Cancel" value="Return to Access Menu"  onClick="self.location='index.php'"  />
</div></td>
      </tr>
<? //} ?>
  </table>
    <input type="hidden" name="MM_insert" value="access1">
</form>
<pre>
<?php 
 if ($_POST)  { print_r($_POST); } 
?>
</pre>
</body>
</html>
<?php
mysql_free_result($rsApps);
mysql_free_result($rsUser);
mysql_free_result($rsAppName);
mysql_free_result($rsMenu);
//mysql_free_result($rsYN);
mysql_free_result($rsRestrict);

mysql_free_result($rsAccess);
//ob_flush();
?>

If any one can help get me going in the right direction here, I would greatly appreciate it.

Recommended Answers

All 9 Replies

What is this $expected = array('menuassignment'); for ? Where are you using it ? What is the array you are trying to validate ? Could you explain your problem in detail ?

please forgive me, I should have clarified myslef and code a bit better.

the question about
$expected = array('menuassignment');
This resides in a part of the error checking as shown below. I was attempting to capture the array variables there.

if ($suspect) {
    //$mailSent = false;
	unset($missing);
	}
  else {
    // process the $_POST variables
    foreach ($_POST as $key => $value) {
      // assign to temporary variable and strip whitespace if not an array
      $temp = is_array($value) ? $value : trim($value);
	  // if empty and required, add to $missing array
	  if (empty($temp) && in_array($key, $required)) {
	    array_push($missing, $key);
	    }
	  // otherwise, assign to a variable of the same name as $key
	  elseif (in_array($key, $expected)) {
	    ${$key} = $temp;
	    }
	  }
	}

All I want to do is get the users initial input redisplayed in the form on error check.
Ex.
If selected "Yes" to have access to the "Admin" menu, and didn't complete the rest of the form, the form will the be redisplayed with information on what items are missing/incomplete. It is at this point that I would want the users selection of "Yes" to the Admin menu to be retained on the form.
The select menuassignment[] is where I need to get the values redisplayed.
Thanks for any help!

umm.. is menuassignment an array and are you trying to assign that array to $expected ? Sorry for my ignorance, but I still don't get it. What is the problem exactly ?

menuassignment is an array for insert/update

<select name="menuassignment[]">
	<option value=""
	<?php
	$OK = isset($_POST['menuassignment']) ? true : false;
	if ($OK && isset($missing) && in_array('', $_POST['menuassignment'])) { ?>
	selected="selected"
	<?php } ?>></option>
<option value="Yes"<?php if ($OK && isset($missing) && in_array('Yes', $_POST['menuassignment'])) { ?>
selected="selected"<?php } ?>>Yes</option>
<option value="No"<?php  if ($OK && isset($missing) && in_array('No', $_POST['menuassignment'])) { ?>selected="selected"<?php } ?>>No</option>
		</select>

the array assigned for insert/update is

if((isset($_POST['menuname']))|| (isset($_POST['menuassignment']))|| (isset($_POST['id']))|| (isset($_POST['username']))) 
		{
		for($i=0;$i<count($_POST['menuname']);$i++)
			{
			$assigned=$_POST['menuassignment'][$i];
			$MName=$_POST['menuname'][$i];
			//$id=$_POST['mambo_user_id'];
			$menu=$_POST['menu'][$i];
			$username = $row_rsUser['username'];
//insert statement goes here
$insertApps = "INSERT INTO assignedmenu(`username`, `mambo_user_id`, `Access`, `menuname`, `MenuID`)  VALUES('$username', '$id', '$assigned','$MName', $menu)";
             $result1 = mysql_query($insertApps) or die(mysql_error());
		}
	}

in the select menuassignment[] (shown above this text) I was trying to retain the values the user selected for error checking to display back to the form.
I have tried several ways to get this accomplished, but I just can't seem to get it to work. Perhaps the coding in the select menuassignment[] options is incorrect?

I have a form that contains a repeating region that allows an admin to set permissions on menus. I have a select box named "menuassignmnets[]" that I am displaying the options of "", "Yes" or "No".
I have been able to insert/ update everything fine and now I am on to error validation.
I have tried numerous ways to be able to "retain" the values the user selected initially, but have not been sucessful.
i can see by using the

<pre>
<?php 
 if ($_POST)  { print_r($_POST); } 
?>
</pre>

that my array values are correct for insertion, but I need the users selected values to be "shown" in the select box if the form cannot be submitted due to error validation.

I know there are severeal things commented out within the code I have posted but I left them there for reminding what I have already tried for my testing purposes.
Any help would be greatly appreciated.
Jeni

I have been able to sort all this out. If anyone is interested, please let me know and I will post he code.

Yep. Sure.. How did you do it ?

OK...here it is in all it's "Glory"

<?php require_once('../Connections/training.php'); ?>
<?php require_once('../Connections/mambo.php'); ?>
<?
error_reporting(E_ALL ^ E_NOTICE);
session_start();

$id=$_SESSION['mambo_user_id'];
$AccessID=$_SESSION['AccessID'];
$AppName= $_SESSION['web_app_id'];
mysql_select_db($database_training, $training);
$query_rsApps = "SELECT * FROM skills_access WHERE mambo_user_id = '$id'";
$rsApps = mysql_query($query_rsApps, $training) or die(mysql_error());
$row_rsApps = mysql_fetch_assoc($rsApps);
$totalRows_rsApps = mysql_num_rows($rsApps);

mysql_select_db($database_mambo, $mambo);
$query_rsUser = "SELECT * FROM mos_corpusers WHERE id = '$id'";
$rsUser = mysql_query($query_rsUser, $mambo) or die(mysql_error());
$row_rsUser = mysql_fetch_assoc($rsUser);
$totalRows_rsUser = mysql_num_rows($rsUser);

mysql_select_db($database_training, $training);
$query_rsAppName = "SELECT * FROM web_access_applications WHERE  web_app_id = '$AppName' ";
$rsAppName = mysql_query($query_rsAppName, $training) or die(mysql_error());
$row_rsAppName = mysql_fetch_assoc($rsAppName);
$totalRows_rsAppName = mysql_num_rows($rsAppName);
$var= $row_rsAppName['app_description'];
mysql_select_db($database_training, $training);
$query_rsMenu = "SELECT * FROM menu";
$rsMenu = mysql_query($query_rsMenu, $training) or die(mysql_error());
$row_rsMenu = mysql_fetch_assoc($rsMenu);
$totalRows_rsMenu = mysql_num_rows($rsMenu);

mysql_select_db($database_mambo, $mambo);
$query_rsYN = "SELECT * FROM yn";
$rsYN = mysql_query($query_rsYN, $mambo) or die(mysql_error());
$row_rsYN = mysql_fetch_assoc($rsYN);
$totalRows_rsYN = mysql_num_rows($rsYN);

mysql_select_db($database_training, $training);
$query_rsRestrict = "SELECT * FROM skills_access WHERE mambo_user_id = '$id' AND skills_access_id = '$AccessID' ";
//$query_rsRestrict = "SELECT * FROM skills_access WHERE web_app_id ='40' AND mambo_user_id= '$MUID'";

$rsRestrict = mysql_query($query_rsRestrict, $training) or die(mysql_error());
$row_rsRestrict = mysql_fetch_assoc($rsRestrict);
$totalRows_rsRestrict = mysql_num_rows($rsRestrict);

mysql_select_db($database_mambo, $mambo);
$query_rsAccess = "SELECT * FROM assignedmenu WHERE mambo_user_id = '$id' ";
$rsAccess = mysql_query($query_rsAccess, $mambo) or die(mysql_error());
$row_rsAccess = mysql_fetch_assoc($rsAccess);
$totalRows_rsAccess = mysql_num_rows($rsAccess);
//validation
//validate the proper form fields have been entered
$AddData="no";
$warnstart="no";
$MM_flag="MM_insert";
if((isset($_POST["Submit"])) && ($_POST["MM_insert"] == "access1")) 
{
	$AddData="yes";
	$warnstart="no";
		if (!$_POST['restrict']) 
			{ 
				$AddData = "no";
			?>
		<?php

 		if ($warnstart=="no") 
			{ ?>
		<div class="warningstart">Please complete the missing item(s) indicated. </div>
		<?php
			}
		$warnstart="yes";
		if (!$_POST['restrict']) { ?> <div class="warning"><li>Please set the Restrict Record Edit Options</li></div>
		<?php }
} 
foreach($_POST['menuassignment'] as $row=> $assigned)
{
$assigned= $assigned;
$id=$_SESSION['mambo_user_id'];
$username = $row_rsUser['username'];
$menu=$_POST['menu'][$row];
$MenuID = $_POST['menu'][$row];
$MName=$_POST['menuname'][$row];
		   ///echo out error message
			if ($assigned =="")
				{
						$AddData = "no";
						if ($warnstart=="no") 
					{ ?>
						<div class="warningstart">Please complete the missing item(s) indicated. </div>
					<?php } $warnstart="yes";?> 
						<div class="warning"><li>Please set the Menu Assignment Options for <? echo $MName; ?> Menu</li></div>
		 <?php } 
		}
		if ($warnstart=="yes") 
		{ ?><div class="warningend"></div>
		<?php } 
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
if((isset($_POST["Submit"])) && ($_POST["MM_insert"] == "access1") && $AddData=="yes" ) 
{
			$updateApps= sprintf("UPDATE `skills_access` SET `restrict`=%s WHERE `mambo_user_id`=%s AND `web_app_id`=%s",
                       GetSQLValueString($restrict, "text"),
                       GetSQLValueString($mambo_user_id, "text"),
					   GetSQLValueString($web_app_id, "int"));
	
  			mysql_select_db($database_training, $training);
		   $result2 = mysql_query($updateApps, $training) or die(mysql_error());

//echo $updateApps;
if((isset($_POST['menu']))|| (isset($_POST['menuassignment']))|| (isset($_POST['id']))|| (isset($_POST['username']))) 
	{		

foreach($_POST['menuassignment'] as $row=> $assigned){
$assigned= $assigned;
$id=$_SESSION['mambo_user_id'];
$username = $row_rsUser['username'];
$menu=$_POST['menu'][$row];
$MenuID = $_POST['menu'][$row];
$MName=$_POST['menuname'][$row];
                              
$insertApps = "INSERT INTO assignedmenu(`username`, `mambo_user_id`, `Access`, `menuname`, `MenuID`)  VALUES('".$username."', '".$id."', '".$assigned."','".$MName."', '".$menu."')";
             $result1 = mysql_query($insertApps) or die(mysql_error());
		}
	}
///////////////////////////	
// here put the insertgoto page
  $insertGoTo = "access2.php";
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Assign Restricted Access - Training Module</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
  .warning {
	background-color: #ffffee;
	color: #660000;
	width: 650px;
	padding: 5px;
	border-right-width: thin;
	border-left-width: thin;
	border-right-style: solid;
	border-left-style: solid;
	border-right-color: #FF0000;
	border-left-color: #FF0000;
	text-indent: 20px;
  }
   .warningend {
	background-color: #ffffee;
	color: #660000;
	width: 650px;
	padding: 5px;
	border-right-width: thin;
	border-left-width: thin;
	border-right-style: solid;
	border-left-style: solid;
	border-right-color: #FF0000;
	border-left-color: #FF0000;
	border-bottom-width: thin;
	border-bottom-style: solid;
	border-bottom-color: #FF0000;
  }
    .warningstart {
	background-color: #ffffee;
	color: #660000;
	width: 650px;
	padding: 5px;
	border-right-width: thin;
	border-left-width: thin;
	border-right-style: solid;
	border-left-style: solid;
	border-right-color: #FF0000;
	border-left-color: #FF0000;
	border-top-width: thin;
	border-top-style: solid;
	border-top-color: #FF0000;
  }
  .notify {
    border: 1px solid #336699;
    background-color: #ffffee;
    color: #336699;
    width: 650px;
    padding: 5px;
  }
-->
</style>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000066;
}
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<? $_SESSION['AccessID']; ?>
<form id="access1" name="access1" method="POST" >
<? $AppName= $_SESSION['web_app_id'];?>
  <table width="550" border="1" bordercolor="#000066">
    <tr>
      <td colspan="2" scope="row"><div align="center"><strong>Training Database Menu Security &amp; Restrict Record Edit </strong></div></td>
    </tr>
    <tr>
      <td colspan="2" scope="row"><div align="left"><b>
          <?php echo $row_rsUser['username']; ?>
	     <input name="web_app_id" type="hidden" id="web_app_id" value="<? echo $AppName; ?>" />
		<input name="username" type="hidden" value="<? echo $row_rsUser['username'] ; ?>" />
		<input name="id[]" type="hidden" value="<? echo $_SESSION['mambo_user_id']; ?>">
		<input name="skill_access_id" type="hidden" value="<? echo $_SESSION['AccessID']; ?>" /><? //echo $_SESSION['AccessID']; ?>
    </div></td>
    </tr>
    <tr>
      <td width="218" valign="middle" scope="row"><? echo $var; ?></td>
      <td width="316" valign="middle" scope="row">Restrict Record Edit?

<?php 
// initialize or capture variable 
$XX = !isset($_POST['restrict'])? NULL : $_POST['restrict']; 
?> 
<select name="restrict">
<option value="<?php echo $XX;?>" SELECTED><?php echo $XX;?></option> 
<option value="Yes">Yes</option> 
<option value="No">No</option> 
</select>

	  </td>
    </tr>
<tr>
      <td height="46" colspan="2" valign="middle" scope="row"><div align="center"><span class="style1"><em>Please indicate which menus the user will have access to</em>. </span></div></td>
    </tr>
  </table> 
  <table width="550" border="1" bordercolor="#00066">
   
      <?php do { ?>
	  <tr>
        <td width="227" valign="middle" scope="row"><B>
          <input name="menu[<?php echo $row_rsMenu['MenuID']; ?>]" type="hidden" id="menu" value="<?php echo $row_rsMenu['MenuID']; ?>" />
         <?php echo $row_rsMenu['menuname']; ?>
		  <input name="menuname[<?php echo $row_rsMenu['MenuID']; ?>]" type="hidden" value="<? echo $row_rsMenu['menuname'] ; ?>" />
        </B></td>
		<td>
<select name="menuassignment[<?php echo $row_rsMenu['MenuID']; ?>]" id="menuassignment<?php echo $row_rsMenu['MenuID']; ?>">
<option value=""<?php if(!isset($_POST['menuassignment'][$row_rsMenu['MenuID']]) || $_POST['menuassignment'][$row_rsMenu['MenuID']] == ""){ ?> selected="selected"<?php } ?>></option>
<option value="Yes"<?php if(isset($_POST['menuassignment'][$row_rsMenu['MenuID']]) && $_POST['menuassignment'][$row_rsMenu['MenuID']] == "Yes"){ ?>selected="selected"<?php } ?>>Yes</option>
<option value="No"<?php if(isset($_POST['menuassignment'][$row_rsMenu['MenuID']]) && $_POST['menuassignment'][$row_rsMenu['MenuID']] == "No"){ ?>selected="selected"<?php } ?>>No</option>
</select>
				</tr>
<?php } while ($row_rsMenu = mysql_fetch_assoc($rsMenu)); ?>
      <tr>
        <td colspan="2" valign="middle" scope="row"><div align="center">
          <input name="Submit" type="Submit" id="Submit" value="Submit" />
        &nbsp;&nbsp;<input type="button" name="Cancel" value="Return to Access Menu"  onClick="self.location='index.php'"  />
		</div></td>
      </tr>
  </table>
    <input type="hidden" name="MM_insert" value="access1">
</form>
<pre>
<?php 
 //if ($_POST)  { print_r($_POST); } 
?>
</pre>
</body>
</html>
<?php
mysql_free_result($rsApps);
mysql_free_result($rsUser);
mysql_free_result($rsAppName);
mysql_free_result($rsMenu);
mysql_free_result($rsYN);
mysql_free_result($rsRestrict);
mysql_free_result($rsAccess);
?>

lil complicated script, this one ! :P

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.