RE: [PHP] Saving form input fields to MySQL br clicking on a button

2002-10-31 Thread Jay Blanchard
[snip]
I created a button called Memorize but how do I have the page save the
values to my MySQL database when the user clicks on the button.  I
understand that I can only use JavaScript to trap the OnClick() function
and not PHP but I cannot use JavaScript to write to a MySQL table.  I do not
want to submit as that would reload the form and the user would lose other
changes to other fields.

Any idea?
[/snip]

Yep. Submit the form variables to a PHP script that either does a SQL UPDATE
or INSERT depending upon the condition of the form information. JavaScript
is not necessary for this.

HTH!

Jay



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




Re: [PHP] Saving form input fields to MySQL br clicking on a button

2002-10-31 Thread Sascha Cunz
Hi,

 Hi,

 I have a form where the user enters some information.  For a particular
 section of the form, I'd like the user to be able to save what he/she
 entered so that the next time they feel out the form, they can recall
 without the need to retype.  This is not for the entire form but only for a
 few input text fields.

 I created a button called Memorize but how do I have the page save the
 values to my MySQL database when the user clicks on the button.  I
 understand that I can only use JavaScript to trap the OnClick() function
 and not PHP but I cannot use JavaScript to write to a MySQL table.  I do
 not want to submit as that would reload the form and the user would lose
 other changes to other fields.

 Any idea?

 Don

As you say it yourself, you can't use mySQL with JavaScript. Do a submit to a 
php-script, and restore the original page in that php-script.

-Sascha

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




RE: [PHP] Saving form input fields to MySQL br clicking on a button

2002-10-31 Thread Jay Blanchard
[snip]
But how do I submit to a PHP script without moving off of the form?  The
user will be entering lots of information while only a particular section
pertains to the Memorize button.  If the user clicks on the button, wont it
move off of the page thereby causing the user to lose all their form input?
[/snip]

Old Indian Rope Trick... have the variables posted (UPDATED or INSERTED) by
the processing page which returns (via header()) to the form page which
retrieves the variables from the DB. You would have to use a session or a
cookie to maintain the user so that the query would know which data to look
for, but when clicking 'Memorize' the user may see a brief flash of some
sort, but not likely.

Jay





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




Re: [PHP] Saving form input fields to MySQL br clicking on a button

2002-10-31 Thread Don
- Original Message -
From: Jay Blanchard
To: 'DonPro' ; 'php list'
Sent: Thursday, October 31, 2002 3:43 PM
Subject: RE: [PHP] Saving form input fields to MySQL br clicking on a button


[snip]
I created a button called Memorize but how do I have the page save the
values to my MySQL database when the user clicks on the button.  I
understand that I can only use JavaScript to trap the OnClick() function
and not PHP but I cannot use JavaScript to write to a MySQL table.  I do not
want to submit as that would reload the form and the user would lose other
changes to other fields.

Any idea?
[/snip]

Yep. Submit the form variables to a PHP script that either does a SQL UPDATE
or INSERT depending upon the condition of the form information. JavaScript
is not necessary for this.

HTH!

Jay



Thanks,

But how do I submit to a PHP script without moving off of the form?  The
user will be entering lots of information while only a particular section
pertains to the Memorize button.  If the user clicks on the button, wont it
move off of the page thereby causing the user to lose all their form input?



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




Re: [PHP] Saving form input fields to MySQL br clicking on a button

2002-10-31 Thread PHP List
Why not use the Memorize button to set a hidden field? Or just use a check
box.
Since you are going to be submitting the data anyway, save the fields at
that time depending on whether or not the check box/hidden filed is set?


 Hi,

 I have a form where the user enters some information.  For a particular
 section of the form, I'd like the user to be able to save what he/she
 entered so that the next time they feel out the form, they can recall
 without the need to retype.  This is not for the entire form but only for
a
 few input text fields.

 I created a button called Memorize but how do I have the page save the
 values to my MySQL database when the user clicks on the button.  I
 understand that I can only use JavaScript to trap the OnClick() function
 and not PHP but I cannot use JavaScript to write to a MySQL table.  I do
not
 want to submit as that would reload the form and the user would lose other
 changes to other fields.

 Any idea?

 Don



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



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




Re: [PHP] Saving form input fields to MySQL br clicking on a button

2002-10-31 Thread DonPro
These two ideas, I really like.  Saves me lots of coding

Thanks,
Don
  - Original Message - 
  From: PHP List 
  To: php ; DonPro 
  Sent: Thursday, October 31, 2002 4:09 PM
  Subject: Re: [PHP] Saving form input fields to MySQL br clicking on a button


  Why not use the Memorize button to set a hidden field? Or just use a check
  box.
  Since you are going to be submitting the data anyway, save the fields at
  that time depending on whether or not the check box/hidden filed is set?


   Hi,
  
   I have a form where the user enters some information.  For a particular
   section of the form, I'd like the user to be able to save what he/she
   entered so that the next time they feel out the form, they can recall
   without the need to retype.  This is not for the entire form but only for
  a
   few input text fields.
  
   I created a button called Memorize but how do I have the page save the
   values to my MySQL database when the user clicks on the button.  I
   understand that I can only use JavaScript to trap the OnClick() function
   and not PHP but I cannot use JavaScript to write to a MySQL table.  I do
  not
   want to submit as that would reload the form and the user would lose other
   changes to other fields.
  
   Any idea?
  
   Don
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php