|
Posted by kenoli on 12/22/06 14:43
I'm not sure what you are trying to do here exactly, but you may be
wanting to provide the user with a sense of security that as she enters
data in a long form or if she walks away from her computer for a minute
her enterred data will not be lost if something screws up. I notice
that sometimes I refelxively hit command-save on my computer
periodically as I would when working in a text editor when filling out
a long form or providing a long answer on a forum like this and get
diverted by the computer trying to save the web page.
If this is what you are trying to do, I can think of some php ways to
do it, like hitting save and having the data enterred in the database
and then retrieved and displayed in the same form for the use to
continur filling out.
A more elegant way is to use AJAX and have each item automatically
saved to the database as the user either moves to the next field or
hits the save button. Ajax incorporates a javascript function which
will save and re-display that one piece of data without having to
refresh the whole page.
There are lots of resources on AJAX and it is pretty easy to implement
without knowing javascript especially for something as simple as this.
--Kenoli
pu wrote:
> Hi
>
> I have the following code and wish for the Save button to be sent to another
> form.
>
> e.g.
> ===begin===
> <?
> etc etc
>
> if(ISSET($_POST['submitclient'])) {
> // read in values from mysql database
> }
> if(ISSET($_POST['submitsender'])) {
> // read in values from mysql database
> }
> // $clientname=. have correct values
> // $sendername=... have correct values
>
> echo "<form action=self.php method=post>";
> echo "<input type=text name=clientname value='".$clientname."'>";
> echo "<input type=submit name=submitclient value='Get Client'>";
> echo "<input type=text name=sendername value='".$sendername."'>";
> echo "<input type=submit name=submitsender value='Get Sender'>";
> echo "<input type=submit name=submitsave value='SAVE'>";
> echo "</form>";
> ===end===
>
> File savedata.php
> ===begin===
> etc etc
> $clientname=$_POST['clientname'];
> etc etc reading in the POST values.
> $q="insert into tablename (clientname, sendername, etc, etc)
> values('".$callername."','",$sendername,' etc etc
> etc etc
> ===end===
>
> How do I post the form values to a separate save form, say, savedata.php,
> instead of self.php, if I click the SAVE button?
>
> Regards
> Leigh
>
> CC to leejen666@hotmail.com
Navigation:
[Reply to this message]
|