davidannis Posted June 1, 2013 Share Posted June 1, 2013 You didn't apply the previously mentioned fixes. This: <td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td> should be something like this: <td><form action=\"bills.php\" method=\"POST\"> <input type=\"submit\" name=\"submit\" value=\"Remove\"><input type=\"hidden\" name=\"id\" value=\"$id\"></form></td> Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1433555 Share on other sites More sharing options...
davidannis Posted June 1, 2013 Share Posted June 1, 2013 (edited) <form action=bills.php method=POST<input type=submit name=submit value=Remove</form> Valid HTML would be helpful here. I pointed that out in replies 18 and 19 on this thread. If OP doesn't fix it this go around I think I'm done with this topic. Apologies for the snarky tone. Edited June 1, 2013 by davidannis Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1433556 Share on other sites More sharing options...
boompa Posted June 1, 2013 Share Posted June 1, 2013 Sorry, I missed that. Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1433558 Share on other sites More sharing options...
tuxtux Posted June 1, 2013 Share Posted June 1, 2013 How do I know that id is an integer? Probably is but I don't think that you can tell from the code. If it is an integer and is never going to change to a string then you are right making it an int will be faster. can't remember ever seeing an id that wasn't an integer Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1433592 Share on other sites More sharing options...
gitn32 Posted June 11, 2013 Author Share Posted June 11, 2013 If fixed this on my real code. Let me re-explain the problem. I have 2 pieces of data. They are both displayed on the webpage. They each have the own account balance. For example, 1 can be 500, and the other can be 750. Lets say 500 is on the top of the page. I click the remove button, and 750 (which is on the bottom of the page) is subtracted from the account balance. I would like to make it where, when I click the top amount (500), that 500 is subtracted from the account balance, instead of 750. Your guys are telling me what's wrong with my HTML, which I have fixed. I appreciate that, but it's not the question. Please trty and help with the one above, if you can't help then that's fine. I appreciate your guys' time. Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1435407 Share on other sites More sharing options...
gitn32 Posted June 15, 2013 Author Share Posted June 15, 2013 ^ Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1436141 Share on other sites More sharing options...
mac_gyver Posted June 15, 2013 Share Posted June 15, 2013 if you understood the method of passing the id of each piece of data as a hidden field in the delete logic, what exact problem are you having applying that method to the update logic? just posting your update logic (repeatedly) and asking what to do for it, when you just went through the process of making your delete logic work, isn't going to get you much sympathy or help on a forum. Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1436147 Share on other sites More sharing options...
gitn32 Posted June 23, 2013 Author Share Posted June 23, 2013 I have the if isset post submit. But I don't understand the part about transferring the id to update the amount. I'm am fairly new to this, and am just looking for some help. Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1437530 Share on other sites More sharing options...
gitn32 Posted June 23, 2013 Author Share Posted June 23, 2013 And you are logged in as a user. So I guess the problem is my query: mysql_query("UPDATE users SET accbal = '$newaccbal' WHERE id = $_POST['id'] AND username = '$user'"); This is what I have, and I'm using the hidden input, but it comes up with a error. Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1437559 Share on other sites More sharing options...
mac_gyver Posted June 23, 2013 Share Posted June 23, 2013 if you look at the code you ended up with for the delete process, i'm willing to bet that's not how you got the id value into the query statement. you just successfully passed an id value through a form and into the query for your delete process, other than the query changing to an UPDATE query and there being an amount involved, the method and your code should be nearly identical. Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1437578 Share on other sites More sharing options...
gitn32 Posted June 26, 2013 Author Share Posted June 26, 2013 I appreciate the help Quote Link to comment https://forums.phpfreaks.com/topic/278384-one-submit-button-for-multiple-pieces-of-data/page/2/#findComment-1437893 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.