hi everybody .. i want to use post method but not working i dont send to data ... pls help me

//i want to send userID and roleID in database .. i use to this code :::

<?php
echo "<table border='1'>
		  <tr>
		  <th><font color='white'><h3>User ID</font></th>
		  <th><font color='white'><h3>User Name</font></th>
		  <th><font color='white'>Roles</font></th>
		  </tr>";
$mysqli = new mysqli("localhost", "root", "", "petdb");
    $sql = "SELECT u.*,r.roleName from users u,roles r where u.roleID=r.roleID ";
    $res = mysqli_query($mysqli, $sql);
	
      if ($res) 
	  {
        while ($newArray = mysqli_fetch_array($res, MYSQLI_ASSOC)) 
		{
          $userID  = $newArray['userID'];
          $userName = $newArray['userName'];
		  $roleName=$newArray['roleName'];
		  $roleID=$newArray['roleID'];
          
		  echo"<tr form name=frmTest action='edit.php' method=POST>
		  <td><font color='red'>".$userID."</form></font></td>
		  <td><font color='red'>".$userName."</font></td>
		   <td><font color='red'><input type='submit' name='button' value=".$roleID.">".$roleName."</font></td>
		  </tr></form>";
			  
        }
      }  else 
	  {
          printf("Petition could not be found");
      }
?>	

//--------------

//this code i use to change to roleID in Database by userId and save to database :

//i use to comboBox 

<?php

$user=$_POST['$userID'];

	  echo "<form name=frmTest>
  <p><center>
  <select name='ComboName[]' onChange='frmTest.submit();'>
    <option value='' SELECTED>Choose One 
    <option value='0'>Admin
    <option value='1'>Student
    <option value='2'>Advisor
    <option value='3'>Dept Head
    <option value='4'>Dean
    <option value='5'>Rector
  </select></p></center></form>";

include("config.php");
$roles = $_POST['ComboName[]'];

$sql = mysql_query("update users set roleID='$roles' where userID='$user'");

?>

Recommended Answers

All 2 Replies

hello
you are using the <form> tag in <tr> tag, which is the reason ur post method is not working.
start ur <form> before starting <table> tag that will b much better.

ok now working thank you

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.