| | |
Help with form buttons
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2006
Posts: 164
Reputation:
Solved Threads: 3
Hey everyone. I'm trying to write code to update a stat field within my database and I'm having some trouble passing the variables from the form page to the process page. Below is my code. I know it's not correct. I just want a button to say "Upgrade attribute 1" and on click it goes to process.php, figures out what button was clicked and then runs the function addOneStat which adds one to the stat field. In the future I will have many buttons and I was hoping that the process page could tell the difference between what button was clicked. Any suggestions?? Thanks.
PHP Syntax (Toggle Plain Text)
//form page <table> <tr><td> <form action="process.php" method="POST"> Update att1: <input type="hidden" name="subupgradestat" value="att1"> <input type="submit" name="att1" value="att1"> </form> </td></tr> </table>
PHP Syntax (Toggle Plain Text)
//process.php function procUpdateStat() { global $session, $database; if($_POST['att1']) { $database->addOneStat($field); header("Location: index.php?page=levelup&id=$session->userid"); } }
![]() |
Similar Threads
- How do I pass values from a called form to a calling forms variables? (C++)
- Visual C++ error LNK2022: metadata operation failed (80131187) (C++)
- I need to write code for the save and close botton and close button on my form (C#)
- Making a Fullscreen form and hiding the Windows Taskbar (Pascal and Delphi)
- want one more help (HTML and CSS)
- VB and Excel. (Visual Basic 4 / 5 / 6)
- Macros (Visual Basic 4 / 5 / 6)
- Please Help!!! MOD function (ASP)
Other Threads in the PHP Forum
- Previous Thread: mysql injection
- Next Thread: new to PHP and need help
| Thread Tools | Search this Thread |
apache api array beginner binary body broken cakephp cheap checkbox class cms code computing cron curl database date date/time delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime global google host href htaccess html image include insert ip javascript joomla limit link list login mail memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php problem query radio random recourse recursion regex remote script search seo server sessions sms snippet source space sql static syntax system table thesishelp tutorial update upload url validator variable video web webdesign xml youtube





