| | |
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 |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





