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

form question

Hello!

(sorry for my bad english)

the following problem: i have i site where one must enter data which is
safed in a database.

There are also drop down lists, which values are database driven. the
user can and must sometimes ad values to this drop down list.

When he enters data in the fields (and there is a lot of data) and he
comes to a drop down list he may see that the option he needs is not in
there. Because of that he has to go another site to add the data. (link
"add new item" and here i just open a new site)

The Problem is how can i actualize the drop down list so that the new
item is in there without loosing all the information the user already
wrote into the formular?

Thanks in advance

Flos
Jul 17 '05 #1
6 1829
Flos wrote:
(sorry for my bad english)
Your english is good enough to ask what you need.
Thank you for having the trouble to translate to English.

the following problem: i have i site where one must enter data which is
safed in a database.

There are also drop down lists, which values are database driven. the
user can and must sometimes ad values to this drop down list.

When he enters data in the fields (and there is a lot of data) and he
comes to a drop down list he may see that the option he needs is not in
there. Because of that he has to go another site to add the data. (link
"add new item" and here i just open a new site)

The Problem is how can i actualize the drop down list so that the new
item is in there without loosing all the information the user already
wrote into the formular?


Make the "add new item" link a submit button.
Make the receiving script identify what button was pressed:

If it was the 'normal' submit button, save data to database and go on to
the "Thank you" page.

If it was the "add new item" button, save the available (and incomplete)
data to somewhere (possible a $_SESSION variable), go to the "add new
item" page, process it and when you resend the form fill its values with
the saved data.

HTH

Happy Coding :-)

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
Make the "add new item" link a submit button.
Make the receiving script identify what button was pressed:

If it was the 'normal' submit button, save data to database and go on to
the "Thank you" page.

If it was the "add new item" button, save the available (and incomplete)
data to somewhere (possible a $_SESSION variable), go to the "add new
item" page, process it and when you resend the form fill its values with
the saved data.

HTH

Happy Coding :-)


perfect, I will do that, thanks a lot!

Flos
Jul 17 '05 #3
Flos wrote:
Hello!

(sorry for my bad english)

the following problem: i have i site where one must enter data which is
safed in a database.

There are also drop down lists, which values are database driven. the
user can and must sometimes ad values to this drop down list.

When he enters data in the fields (and there is a lot of data) and he
comes to a drop down list he may see that the option he needs is not in
there. Because of that he has to go another site to add the data. (link
"add new item" and here i just open a new site)

The Problem is how can i actualize the drop down list so that the new
item is in there without loosing all the information the user already
wrote into the formular?


Is this an internet or an intranet application? I regularly do this
using javascript.

Add new item opens a new form (or javascript prompt) to collect the
value then uses window.opener.additem('newitem') which I have coded in
the parent window to add to the drop down.

Of course this is intranet only as you can't rely on js on the internet.
Otherwise you'll have to submit the whole main form on clicking the 'add
new item' button, collect details on the new item then redirect to the
original form with the previous values.
Jul 17 '05 #4

now i have another problem. when i do it like you describe with add new
item i have to know the id (which is an auto_increment) of the main data
when adding the new item, in order to connect the two datas. but the id
i will know after inserted the main data.

I can try with mysql_insert ()+1 but if there are two people working
with the database at the same time?

Do I have to save the additional data and save it after the main data???

Thankx in advance

Flos
Jul 17 '05 #5
In article <MP************************@News.Individual.DE>, Flos wrote:

now i have another problem. when i do it like you describe with add new
item i have to know the id (which is an auto_increment) of the main data
when adding the new item, in order to connect the two datas. but the id
i will know after inserted the main data.
Have a look at the manual http://www.mysql.com/manual and have a look at
what SELECT LAST_INSERT_ID() returns.
I can try with mysql_insert ()+1 but if there are two people working
with the database at the same time?


Again, you have to lookup in the manual what transactions are, how you
can use them. And you could also lookup what the function LOCK does.
--
http://home.mysth.be/~timvw
Jul 17 '05 #6
"Flos" <fl**********@hotmail.com> wrote in message
news:MP************************@News.Individual.DE ...

now i have another problem. when i do it like you describe with add new
item i have to know the id (which is an auto_increment) of the main data
when adding the new item, in order to connect the two datas. but the id
i will know after inserted the main data.

I can try with mysql_insert ()+1 but if there are two people working
with the database at the same time?


See http://www.php.net/mysql_insert_id
Jul 17 '05 #7

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

Similar topics

16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
3
by: Kaur | last post by:
Hi, I would appriceate any help to correct the code error that I am getting for the onclick event of a cmd button. I have two forms. Main Form "frmQuestion" and form 2 "SfrmQuestion"....
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
1
by: MrHelpMe | last post by:
Hello experts, I need a hand. On my asp submit page I have the following code: for i = 1 to 5 ' 5 question form' Question = Request.Form("Q" & i) Answer = Request.Form("A" & i) Comment ...
26
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when...
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
6
by: smk17 | last post by:
I've spent the last few minutes searching for this question and I found an answer, but it wasn't quite what the client wanted. I have a simple online form where the user needs to fill out five...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...

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.