Re: PHP saving forms on client side

From: Date: Wed, 14 Mar 2001 23:06:17 +0000
Subject: Re: PHP saving forms on client side
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43921@lists.php.net to get a copy of this message
I dont know what you call 'feasable' but this would be the most efficient way of doing this: <FORM NAME="coolform" METHOD=POST ACTION='<reference to self>'> <INPUT type="text" name="firstName" value="<?=$firstName?>"></INPUT> <INPUT type="text" name="lastName" value="<?=$lastName?>"></INPUT> <INPUT type="submit" onClick="submitToServer();" value="Submit to server"></INPUT> <INPUT type="submit" onClick="submitToRegenerator();" value="Generate saveable form"></INPUT> </FORM> <SCRIPT> function submitToServer() { document.forms['coolform'].action = '<submit to server url>'; document.forms['coolform'].submit(); // May not be necessary } function submitToRegenerator() { document.forms['coolform'].action = '<submit to self url>'; document.forms['coolform'].submit(); // May not be necessary } </SCRIPT> When the form is initially loaded, $firstName will not exist, therefore the form filed will appear blank. When a special type of submit is clicked (ie a 'generate partially filled out form' submit) it would simply re-render the page but with all the values in the actual HTML. You can change the submit locations of a single form depending on the button pressed using some simple Java Script ... included ... but check the object paths of document.forms['...'].action - I havent coded JS in a long while! AndrewH ----- Original Message ----- From: "mat t" <mat@remail.net> To: <php-general@lists.php.net> Sent: Thursday, March 15, 2001 7:57 AM Subject: [PHP] PHP saving forms on client side > I have new "blank" forms on the server and I would like to give my client an option to save a partially filled form to his computer. Is there any way I can do this with php? > > I know that if the client just saves the form using his browser then it will only save the initial HTML, and ignore the partially filled bits. Therefore I need to use post/get to send the partially filled bits to PHP, > > This means hard coding all the HTML (in php) and inserting the variables that are posted from the previous form. > > Is there any simpler/easier way of doing this with PHP? because this is not feasible if there are 100s of forms. > > Thanks, > Matt > > > _____________________________________________________________ > Pick up your email anywhere in the world ---> > http://www.remail.net > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#43921) next »