Hi guys,
I want to know how to fill a list/menu box with the column: "id_utiliza dor" from table: "tbl_utilizador es" from database: "db_faq".
And when i select a id on that box i want it to fill the fields, which are ("utilizador ", "email", "password", "administrator" ).
This page is a update page for admin use only (that is taken care of).
This is the update page code (atualizar_regi sto.php): - <?php require_once('Connections/FAQ.php'); ?>
-
<?php
-
if (!isset($_SESSION)) {
-
session_start();
-
}
-
$MM_authorizedUsers = "1";
-
$MM_donotCheckaccess = "false";
-
-
// *** Restrict Access To Page: Grant or deny access to this page
-
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
-
// For security, start by assuming the visitor is NOT authorized.
-
$isValid = False;
-
-
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
-
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
-
if (!empty($UserName)) {
-
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
-
// Parse the strings into arrays.
-
$arrUsers = Explode(",", $strUsers);
-
$arrGroups = Explode(",", $strGroups);
-
if (in_array($UserName, $arrUsers)) {
-
$isValid = true;
-
}
-
// Or, you may restrict access to only certain users based on their username.
-
if (in_array($UserGroup, $arrGroups)) {
-
$isValid = true;
-
}
-
if (($strUsers == "") && false) {
-
$isValid = true;
-
}
-
}
-
return $isValid;
-
}
-
-
$MM_restrictGoTo = "login_errado.php";
-
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
-
$MM_qsChar = "?";
-
$MM_referrer = $_SERVER['PHP_SELF'];
-
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
-
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
-
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
-
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
-
header("Location: ". $MM_restrictGoTo);
-
exit;
-
}
-
?>
-
<?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;
-
}
-
}
-
-
$editFormAction = $_SERVER['PHP_SELF'];
-
if (isset($_SERVER['QUERY_STRING'])) {
-
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
-
}
-
-
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
-
$updateSQL = sprintf("UPDATE tbl_utilizadores SET utilizador=%s, password=%s, email=%s WHERE id_utilizador=%s",
-
GetSQLValueString($_POST['utilizador'], "text"),
-
GetSQLValueString($_POST['password'], "text"),
-
GetSQLValueString($_POST['email'], "text"),
-
GetSQLValueString($_POST['id_utilizador'], "int"));
-
-
mysql_select_db($database_FAQ, $FAQ);
-
$Result1 = mysql_query($updateSQL, $FAQ) or die(mysql_error());
-
-
$updateGoTo = "login.php";
-
if (isset($_SERVER['QUERY_STRING'])) {
-
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
-
$updateGoTo .= $_SERVER['QUERY_STRING'];
-
}
-
header(sprintf("Location: %s", $updateGoTo));
-
}
-
-
$colname_Utilizadores = "-1";
-
if (isset($_GET['id_utilizador'])) {
-
$colname_Utilizadores = $_GET['id_utilizador'];
-
}
-
mysql_select_db($database_FAQ, $FAQ);
-
$query_Utilizadores = sprintf("SELECT * FROM tbl_utilizadores WHERE id_utilizador = %s", GetSQLValueString($colname_Utilizadores, "int"));
-
$Utilizadores = mysql_query($query_Utilizadores, $FAQ) or die(mysql_error());
-
$row_Utilizadores = mysql_fetch_assoc($Utilizadores);
-
$totalRows_Utilizadores = mysql_num_rows($Utilizadores);
-
?>
-
<!doctype html>
-
<html>
-
<head>
-
<meta charset="utf-8">
-
<title>Atualizar Registo</title>
-
</head>
-
-
<body>
-
<h1>Atualizar Registo</h1>
-
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
-
<table align="center">
-
<tr valign="baseline">
-
<td nowrap align="right">ID:</td>
-
<td></td>
-
</tr>
-
<tr valign="baseline">
-
<td nowrap align="right">Utilizador:</td>
-
<td><input type="text" name="utilizador" value="<?php echo htmlentities($row_Utilizadores['utilizador'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
-
</tr>
-
<tr valign="baseline">
-
<td nowrap align="right">Password:</td>
-
<td><input type="text" name="password" value="<?php echo htmlentities($row_Utilizadores['password'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
-
</tr>
-
<tr valign="baseline">
-
<td nowrap align="right">Email:</td>
-
<td><input type="text" name="email" value="<?php echo htmlentities($row_Utilizadores['email'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
-
</tr>
-
<tr valign="baseline">
-
<td nowrap align="right">Admin:</td>
-
<td><input type="text" name="administrator" value="<?php echo htmlentities($row_Utilizadores['administrator'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
-
</tr>
-
<tr valign="baseline">
-
<td nowrap align="right"> </td>
-
<td><input type="submit" value="Atualizar Registo"></td>
-
</tr>
-
</table>
-
<input type="hidden" name="MM_update" value="form1">
-
<input type="hidden" name="id_utilizador" value="<?php echo $row_Utilizadores['id_utilizador']; ?>">
-
</form>
-
<p> </p>
-
</body>
-
</html>
-
<?php
-
mysql_free_result($Utilizadores);
-
?>
-
There is an image attached with the page and where the box should be.
Any additional info needed just ask.
Thanks in advance.
Peace,
Slaxer13
PS: Some things may be in portuguese, if you don't understand just let me know...
1 1256
So i managed to make my listbox show the records... - <select name="select" class="textfields" id="ddl_id">
-
<option id="0">-- Selecione o ID --</option>
-
<?php
-
require("dbconfig.php");
-
$get_ids = mysql_query("SELECT * FROM tbl_utilizadores");
-
while($vertodos = mysql_fetch_array($get_ids)){
-
?>
-
<option id="<?php echo $vertodos['id_utilizador'];?>"><?php echo $vertodos['utilizador'] ?></option>
-
<?php } ?>
-
</select>
How do i populate the form based on the record i choose in the list box?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ali poursadri |
last post by:
Hi,
I want to fill my list box from a dataset in c#.
I use adapter and fill command and bind it to a listbox, but it is very slow
for large data about 500000 records.
How can I view this list rapid?
thanks.
|
by: Brian |
last post by:
How can I use javascript to select Items in a List/Menu? For example:
(value1, value2) will select value1 and value2 in a list menu....
|
by: fizzyfozzy |
last post by:
Hi,
I am trying to figure out how to show or hide a selection of divs on my page depending on what is selected from a list/menu item, using css & javascript.
I have tried to use the script listed here: http://www.thescripts.com/forum/thread88791.html
but have been uable to customise it to my needs and could do with some help.
My form is asking people how many tickets they would like to an event & depending on their selection I need...
|
by: TechnoAtif |
last post by:
Hi ALL
I have entered some array values using checkboxes into mysql database through a form. Next iam creating a searchpage where all those cateogories inserted through checkboxes has to be retrieved using list/menu box.
When i check only a single checkbox to insert the checked category ,selecting that category through list box gives out the entire data of the user corresponding to that category.
However when i check multiple checkboxes and...
|
by: jmartmem |
last post by:
Greetings,
I have an ASP page containing a Record Insertion Form with a number of fields (mostly text fields and list/menu fields) linked to an Access database. I've created an onsubmit behavior to validate the form but this validates only the text fields. I'm unsure how to similarly validate the list/menu fields; specifically, to create a behavior that acts as a validation alerting the user when no selection is made in the list/menu.
I'm...
| |
by: stevedude |
last post by:
CSS newbie again. I have a problem trying to get coffee mug images
within anchor tags to center with my link text for a vertical list
menu. If I use the horizontal/vertical properties of "background" or
"background-image", the positioning only works with specifying
pixels.
If I specify the vertical position in pixels, the image gets cut-off
at the bottom. I don't know what to do and would appreciate anyone's
help. Specifically the code...
|
by: jmartmem |
last post by:
Greetings,
I am using Dreamweaver CS3 to design an ASP page that contains an Insert Record Form. Within this form are two list/menu form fields that I would like to "synchronize". In other words, let's say one list/menu is where the user selects "Program Name" and a second is for selecting "Project Name". If the user makes a selection from the first list/menu, then the second list/menu is requeried and "refreshed" to show only the project...
|
by: Mala7 |
last post by:
Hi
I have two list/menu - to be specific they are car Brand menu & car model menu - in my page, what i need to do is to:
- make the car model menu dimmed at the start
- when a selection made to the car brand menu then the car model menu is enabled and the values in the menu should be related to the car brand choice
can i do this with php?? and how??
thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |