473,382 Members | 1,238 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,382 software developers and data experts.

drop-down position

Hi,
I have page1.php with form to fill by customer. Inside form is field
with dynamic drop-down menu (choices from database). On page2.php I
have validation of values posted from page1.php. In case or error or
forbiden values, customer is redirected to page1.php again (with proper
error notification) to correct them. All the values should be preserved
on redirection to page1.php by session variables, so the customer dont
have to fill all the fields again, but only to make correction. It's
easy with <input type="text"...
Now the question:
How to preserve the position choosed from first submition in drop-down
menu since it is dynamicly populated?

THX, everyone.

Sep 14 '06 #1
2 1530
@net:
All the values should be preserved on redirection to page1.php by
session variables, so the customer dont have to fill all the fields
again, but only to make correction. It's easy with <input
type="text"...
Now the question:
How to preserve the position choosed from first submition in
drop-down menu since it is dynamicly populated?
Pick the value out of the session and compare it with the values in
your SELECT. It doesn't matter whether or not those values are pulled
from a database. Whichever one matches the value from the session, add
to its OPTION a selected="selected" attribute spec.

--
Jock

Sep 14 '06 #2
@net wrote:
Hi,
I have page1.php with form to fill by customer. Inside form is field
with dynamic drop-down menu (choices from database). On page2.php I
have validation of values posted from page1.php. In case or error or
forbiden values, customer is redirected to page1.php again (with proper
error notification) to correct them. All the values should be preserved
on redirection to page1.php by session variables, so the customer dont
have to fill all the fields again, but only to make correction. It's
easy with <input type="text"...
Now the question:
How to preserve the position choosed from first submition in drop-down
menu since it is dynamicly populated?

THX, everyone.
heres a function i wrote the other other day, you could change it to
loop through the db result, cause this one was for a static array

function arrayToOptions($array,$selected = null)
{
$result = "";
foreach( $array as $value =$name )
{
$result .=
sprintf('<option value="%s"%s>%s</option>',
$value,($value == $selected)
? ' selected="selected"': "",$name);
}
return $result;
}
Sep 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ian Dobson | last post by:
Hi, I need to drop a schema from a database but it has 400 tables in it. Is there an easy way to do it other than drop table schema1.table1 drop table schema1.table2 etc.. to 400 and then drop...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
8
by: WindAndWaves | last post by:
Hi everyone, Has anyone got any experience with drop and drag in Access? I would like to make a calendar style form where my users can drop and drag appointments.... I am using Access 2003...
1
by: Torre Quinn | last post by:
Does anyone have any good sites or resources dealing with adding drag and drop functionality to a set of controls on a form? I'd like to try to get several examples of varied applications of drag...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When...
15
by: uwcssa | last post by:
I try to drop a table as: I got: During SQL processing it returned: SQL0478N The object type "TABLE" cannot be dropped because there is an object "sch.SQL070515104729271", of type "FUNCTION",...
1
by: Thi | last post by:
Hi, I am trying to develop an application that allows the users to drag a few file(s) from a zip archive to a destination. My question is, how do i determine where the drop destination is...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.