RE: calling function on submit instead of going to a new script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



long story short - you can't

you can only call a function in javascript or some other client-side
scripting language like that, and you would use the onSubmit="" attribute of
the <form> tag.

by the sounds of what you want to do - i would say you would do something
like;

1. load values from db and display in a form (with a submit button, and
perhaps a hidden field of some sort)
2. make your changes on the form and submit it
3. the form posts BACK TO THE SAME PAGE
4. on that page, you check for either the hidden variable (more reliable),
or the variable for the submit button (which gets created when the user
clicks it)
5. do whatever you want with the changes made (UPDATE?), then display the
form again, now with the new values in it.

HTH

Beau


// -----Original Message-----
// From: Gavin Amm [mailto:gavin@ksg.com.au]
// Sent: Thursday, 5 December 2002 1:31 PM
// To: Php-Db (E-mail)
// Subject:  calling function on submit instead of 
// going to a new
// script
// 
// 
// Hi,
// 
// I'm using some form fields on a page to pick up existing 
// data from a MySQL
// database, make any changes, and update the database when i 
// hit "submit".
// I've picked up the data ok, now i want to process the update...
// 
// How do i call a function(?) on the same page rather than use 
// another page
// through action="somescript.php"?
// what i'd like to do (in seudo-code) is:
// 
// <form action="myfunction()">
//   ...
//   <input type="submit">
// </form>
// myfunction(){
//   process update & send user back to homepage
// }
// 
// 
// cheers,
// Gav
// 
// 
// This e-mail and any attachments are intended solely for the 
// named addressee,
// are confidential and may contain legally privileged information. 
// 
// The copying or distribution of them or of any information 
// they contain, by
// anyone other than the addressee, is prohibited. If you 
// received this e-mail
// in error, please notify us immediately by return e-mail or 
// telephone +61 2
// 9413 2944 and destroy the original message. Thank you. 
// 
// As Email is subject to viruses we advise that all Emails and 
// any attachments
// should be scanned by an up to-date Anti Virus programme 
// automatically by
// your system. It is the responsibility of the recipient to 
// ensure that all
// Emails and any attachments are cleared of Viruses before 
// opening. KSG can
// not accept any responsibility for viruses that maybe 
// contained here in.
// Please advise KSG by return Email if you believe any Email 
// sent by our
// system may contain a virus. It should be noted that most Anti Virus
// programmes can not scan encrypted file attachments (example 
// - documents
// saved with a password). Thus extra care should be taken when 
// opening these
// files. 
// 
// Liability limited by the Accountants Scheme, approved under 
// the Professional
// Standards Act 1994 (NSW). 
// 
// 
// 
// Level 4 
// 54 Neridah Street                PO Box 1290 
// CHATSWOOD   NSW   2067           CHATSWOOD   NSW   2057 
// 
// 
// Ph: +61 2 9413 2944              Fax: +61 2 9413 9901
// 
// -- 
// 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux