470,833 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

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 1724
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Philippe C. Martin | last post: by
11 posts views Thread by Jozef | last post: by
15 posts views Thread by http://www.visual-basic-data-mining.net/forum | last post: by
27 posts views Thread by Chris | last post: by
26 posts views Thread by Jerim79 | last post: by
6 posts views Thread by Greg Strong | last post: by
6 posts views Thread by smk17 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.