473,588 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how I make to recoup the value of database and to keep selected in combobox

1 New Member
Hi friends,

how I make to recoup the value of database and to keep selected in combobox to edit my form?

in script below it is selected field of the table that possesss id of the first item of database.

I am catching id of a URL:

[PHP]<?php echo "<a href='alterar_c liente.php?id=$ id'>Alterar</a>"; ?>[/PHP]

[PHP]<?php
include("../config.php");
$sql = mysql_query("SE LECT cidade FROM clientes");
$aux = mysql_fetch_arr ay($sql);
$cidade_cliente = $aux["cidade"];

echo "<select name=\"cidade\" >";
$sql_cidade = mysql_query("SE LECT * FROM cidades ORDER BY cidade ASC");
while($linha=my sql_fetch_array ($sql_cidade)) {
if ($linha[1] == $cidade_cliente ) {
echo"<option value=\"$linha[1]\" selected>$linha[1]</option>";
} else {
echo"<option value=\"$linha[1]\">$linha[1]</option>";
}
};
echo "</select>";
?> [/PHP]

somebody could help me?
Sep 19 '07 #1
1 1659
ronverdonk
4,258 Recognized Expert Specialist
Maybe you should rephrase your question or show us a sample of the code you intend to use to update the db. All I can see in the code shown is that you construct a drop-down box with values from the database.
This drop-down is not within a form and nowhere is to be seen what you intend to do with the selected value from the box.
Show us the code you produced for handling the selected value from the drop-down box and we can see how we can assist you there.

Ronald
Sep 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
12081
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
3
1573
by: Tony Dong | last post by:
Hi there I have three comboBoxs I need the first comboBox selected and fill the second comboBox, after second comboBox selected, it will fill the last comboBox, When I use selectedIndex change event, it happens before I select second comboBox, because when I selected first one, it auto fill the second one and make the selectedindexchanged event happen, how can I disable it untial I select second comboBox? how can I do to make this one...
6
4899
by: Matt | last post by:
I'm not entirely sure how to describe this issue. I have a number of ComboBoxes in my application which have their text properties bound to a field in a data set. The items loaded in the ComboBox are not data bound (they just use the built in collection property of the ComboBox), and they are all set to use the DropDownList style. When moving from record to record via a BindingNavigator or a DataGridView (in master/detail format), the text...
6
3496
by: Scotty | last post by:
Hi, I need some info How to return the value from the database My combobox Me.cboTypeAdres.Items.Add("Type Adres") Me.cboTypeAdres.Items.Add("Leverancier") Me.cboTypeAdres.Items.Add("Klant")
1
10916
by: sangram | last post by:
how to select a default value of combo box in run time, i have select some value from database ,depending on this i have to set the value of combox box... advance thanks..
0
996
by: divyabhasin | last post by:
HI I want to assign a specific value to an item in combobox and want that value to be entered in database instead of the selected item. For Ex- In the Combobox I have selected "PlayFile" ,Now I want to enter "arg" in the database instead of " PlayFile". Please help its really urgent.
19
2194
by: active | last post by:
I'm using a ComboBox to display objects of a class I've defined, say CQQ. Works great except somehow I occasionally set an Item to a String object instead of an object of type CQQ. It looks like Text replaces an item or something like that. This results in a runtime error at which time I learn that the item that should be CQQ is a String.
1
3047
by: daveg | last post by:
Hi I'm populating a combobox using a dataset and dataadaptor. When the combobox is filled it selects the first value in the database (this is what I want it to do). So I've set the text (DisplayMember = "GradeDescription") and the value to be the ID (ValueMember = "ContractID"). But what I want to do is set the combobox's TAG to the first selected value in the combobox, (the value that is selected). Then as I change the value in the...
1
5220
by: sbandalli | last post by:
Hello, I have a Datagridview which has a combobox,and 2 textbox, The combobox is bound to a Datasource(Database Sql Server and the table name is Category) ,and Datagridview is not bounded to any datasource. When the user selects an item in the combobox,and enters the item(text) in the 2 text box , I want all the 3(combobox selected item, and the entered text in the 2 textbox) of them to store it a a table name called...
0
7929
marktang
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...
1
7987
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,...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6634
agi2029
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...
1
5729
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3847
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...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
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
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.