Re: [PHP-DB] Re: saving data From: Adam Royle (digitalbalance <email protected>)
Date: 06/19/02

Well, if they select a field the have previously updated, enter a new value,
the javascript will run again and update the same field. Apart from sending
new data and having an extra db connection, nothing bad happens - this is
because it is an UPDATE query. The query would have the same WHERE clause,
and update the same column, and only the value would change.

Basically, using this technique, it is bad for the database (you might have
10 separate queries, instead of 1), but this is the only way I see. You
could program it in a way that the first field they fill in does an INSERT
query and returns a unique row identifier, and all queries sent after that
are UPDATE queries which use the row identifier.

If you need help constructing it, or figuring something out - I'm free to
help.

Adam

----- Original Message -----
From: Natividad Castro <ncastro <email protected>>
To: Adam Royle <digitalbalance <email protected>>
Sent: Thursday, June 20, 2002 6:05 AM
Subject: RE: [PHP-DB] Re: saving data

> Adan,
> I think this is a great idea, but what would happen if the user wants to
go
> back to change fields that he/she already typed in.
> Don't get me wrong your idea is great and I will try to make it work
>
> Thank you very much for your help
> Nato
>
>
> -----Original Message-----
> From: Adam Royle [mailto:digitalbalance <email protected>]
> Sent: Wednesday, June 19, 2002 8:08 AM
> To: Natividad Castro; php-db <email protected>
> Subject: [PHP-DB] Re: saving data
>
>
> Very interesting question. One way you could do this, is using
> javascript. Basically, you have two frames - one is the form, the other
> is an invisible frame. Then, create a javascript function which sends
> information about what field to update (and also the value to update to)
> to the invisble frame, and put this function in the onBlur bit of your
> form element.
>
> Am I making sense? Basically, what it would do is update the database
> after you click out (or tab or deselect a form element)
>
> example...
>
> this would be the HTML (depending on form contents and database design,
> you might have to include a few more javascript parameters)
>
> <input type="hidden" name="userID" value="<?= $userID ?>">
>
> <input type="text" name="first_name"
> onBlur="updateDB(this.name,this.value,userID.value);">
>
> and the javascript might be
>
> function updateDB(theName, theValue, userID){
> top.invisbleFrame.href =
> "update.php?name="+theName+"&value="+theValue+"&userID="+userID;
> }
>
> of course if you have a complex form/or specific database thingys, this
> might be more complex, but basically this shows the data transfer
> between pages
>
> and in the invisbleFrame (update.php) you might have something like this:
>
> <?php
> dbConnect(); //obviously this is the database connection function
>
> $sql = "UPDATE tablename SET $name = '$value' WHERE userID = $userID";\
> mysql_query($sql)
>
> ?>
>
> I hope that helps. If you need further help or explanation, ask!!!
>
> Adam
>
>
> > Hi to all,
> > Is it possible to save information from a form without being
> > submitted? I
> > know this question might be a little extrange for some of you. The
> > reason
> > why I'm asking this question is because I collect information from
> > different
> > places where users fill out a big form, they're complaining because
> > sometimes they are about to finish filling out the form when they lose
> > connection
> > I was wondering if there is a way to get this data temporaly and then
> > when
> > they reconnet to the system display all the fields with the information
> > they
> > already type in.
> >
> > If someone has any idea, please let me know
> >
> > Thanks in advanced
> > Nato
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php