Jump to content

basscomp

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

basscomp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks a bunch, Got it working now. [!--quoteo(post=361662:date=Apr 4 2006, 02:04 PM:name=jvrothjr)--][div class=\'quotetop\']QUOTE(jvrothjr @ Apr 4 2006, 02:04 PM) [snapback]361662[/snapback][/div][div class=\'quotemain\'][!--quotec--] here is a function I have that displays a user list in a table with the option to edit anyone user and pass that ID to the next funtion to edit that user information. This what I think your asking for [code] function EditUserAdmin($UN_ID){     mysql_select_db("grouplog");     $QSting1 = "Select tbluser.User_Name,tbluser.User_ID,                     tbluser.User_Email,tbluser.Rights,                     tbluser.Location,person.person                 from tbluser                 left join person on tbluser.User_ID=person.User_ID                 where tbluser.UN_ID = '$UN_ID'";     $UserList1 = mysql_query($QSting1);     if ($UserListRow1 = mysql_fetch_array($UserList1)) {         do{             echo "<center><form action=profile.php method=post>";             echo "<TABLE class=profile BORDER=3 align=center>";             echo "<INPUT TYPE=hidden NAME=UN_ID value='".$UN_ID."'>";             echo "<tr><td class=label>User Name:</td>";             echo "<td><INPUT TYPE=TEXT NAME=TUser_Name value='".$UserListRow1['User_Name']."' size=30></td></tr>";             echo "<tr><td class=label>User ID:</td>";             echo "<td><INPUT TYPE=TEXT NAME=TUser_ID value=".$UserListRow1['User_ID']." size=30></td></tr>";             echo "<tr><td class=label>User Email:</td>";             echo"<td><INPUT TYPE=TEXT NAME=TUser_Email value=".$UserListRow1['User_Email']." size=30></td></tr>";             echo "<tr><td class=label>Rights Level:</td>";             echo "<td><INPUT TYPE=TEXT NAME=TRights value=".$UserListRow1['Rights']." maxlength=1 size=30></td></tr>";             echo "<tr><td class=label>Location:</td>";             echo "<td><INPUT TYPE=TEXT NAME=TLocation value=".$UserListRow1['Location']." maxlength=10 size=30></td></tr>";             echo "</table></P>";             echo "<input type=submit name=cmd value='Submit User Edit Profile'>";             echo "</FORM>";             }     while($UserListRow1 = mysql_fetch_array($UserList1));     }     echo "<center><form action='profile.php' method=post>";     echo "<input type=hidden name='UN_ID' value='".$UN_ID."'>";     echo "<input type=submit title='Reset Default Password' name=cmd value='Reset Password'></form></td>"; } [/code] [/quote]
  2. Hello, Just started working with PHP and I am stuck on a particular script. The relevant part of the script is listed below. I am trying to read some data from a mysql server and display each row in a HTML table with a delete button next to that row. I am also passing the same information for every row in hidden text to the my HTML page. I am also generating an id name for each item in a row so that the user can click on any one of the delete buttons on the HTML page and delete the row in the database that's equal to that being displayed. I am thinking about using javascript to set the variables being submitted by the form to the value of any row on the HTML page where I click delete. Is there a better approach? Any help will be appreciated. Thanks.... #Display the table $rc=1;//row count variable $arg4 = 1;//start value for swap function $label = array('network','linename','hostname','msg', 'expire'); $sth = mysql_query("SELECT network,linename,hostname,msg,unixt_exp". " FROM ignore_list ORDER BY unixt_exp"); print " <TR> </TR>"; while ($row = mysql_fetch_row($sth)) { $color=my_color($arg4); print "<TR name=$rc bgcolor=$color>"; $rc2=1;//row count variable 2 for internal ids for ($i=0; $i<count($label)-1; $i++) { print " <TD align=center><INPUT TYPE=HIDDEN NAME='$rc . $rc2' ". "VALUE=\"$row[$i]\">" . $row[$i] . "</TD>"; $rc2 = $rc2 + 1;//update inner id name counter } print "<TD align=center>" . date('l, M. j, Y - h:i:s A', $row[4]). " CST </TD>"; print "<TD align=center><INPUT TYPE=SUBMIT NAME=action ". "VALUE=\" Del \"></TD>"; print "</TR>"; $arg4=swap($arg4);//change swap variable $rc1=$rc + 1; //update id name counter } mysql_free_result($sth); ?> </TABLE> </FORM> </BODY> </HTML>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.