Meissa Posted February 28, 2007 Share Posted February 28, 2007 I'm sorry if this isn't as PHP-related as it could be, but it's all in the name of learning PHP: *When you make a Checkbox in a form, you assign it a value... then you hit another button to submit the value to be processed, right? *When you make a Submit button, if you assign it a value, it displays the value on the button, but does not process that value. (as far as I know) ??? I'm trying to get a Submit button to have a numeric value that I can program into it, that when it is clicked, it will enter that value into a variable and be able to be processed. Basically eliminating the second click that a Checkbox makes you do. I have an example on this page: http://www.strangerthanfact.com/onyxia/formtest.php After you open the page, hit REFRESH to clear the error... And if several people are on this page at one time, the flatfile value will change sporadically. Here's the important stuff from the code: <html> <body> <?php if(isset($_POST['send'])) { $mod = $_POST['modifier']; echo "The last modifier was: "; echo $mod; echo "<br>"; } ?> <hr> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> +1 <input name="modifier" type="checkbox" id="modifier" value="1"> -1 <input name="modifier" type="checkbox" id="modifier" value="-1"> <br> <input type="submit" name="send" value="Calculate!"> </form> <hr> <center> <h2>This is what I want to happen:</h2> </center> <font size="+1"> <br> I want to be able to click these buttons only once and get them to perform the operations of the checkboxes above <br> <br> Add || Subtract </font> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <button> <input name="send" type="submit" id="modifier" value="1"> <img src="http://www.strangerthanfact.com/wowccg/heal-1.bmp"> </button> <button> <input name="send" type="submit" id="modifier" value="-1"> <img src="http://www.strangerthanfact.com/wowccg/dam-1.bmp"> </button> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 28, 2007 Share Posted February 28, 2007 <input type="submit" name="submit" value="1"> <?php if(isset($_POST['submit'])){ print $_POST['submit']; } ?> You can process the value of a submit button. Quote Link to comment Share on other sites More sharing options...
Meissa Posted February 28, 2007 Author Share Posted February 28, 2007 Thank you.. that was enough to head me in the right direction Edit: You are so great!! Thank you /solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.