473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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_cliente.php?id=$id'>Alterar</a>"; ?>[/PHP]

[PHP]<?php
include("../config.php");
$sql = mysql_query("SELECT cidade FROM clientes");
$aux = mysql_fetch_array($sql);
$cidade_cliente = $aux["cidade"];

echo "<select name=\"cidade\">";
$sql_cidade = mysql_query("SELECT * FROM cidades ORDER BY cidade ASC");
while($linha=mysql_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 1631
ronverdonk
4,258 Expert 4TB
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
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...
3
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...
6
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...
6
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")...
1
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
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"...
19
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...
1
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...
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.