Re: saving data

From: Date: Wed, 19 Jun 2002 12:08:05 +0000
Subject: Re: saving data
Groups: php.db 
Request: Send a blank email to php-db+get-19871@lists.php.net to get a copy of this message
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


« previous php.db (#19871) next »