galdikas Posted May 13, 2011 Posted May 13, 2011 <form action='bank.php' method='post'> Amount to invest:<input type='text' name='investment' value='{$bi['money']}'/> For:<select name='period'>"; $ibank=mysql_query("SELECT * FROM ibank"); while($ib=mysql_fetch_assoc($ibank)) { echo"<option value='{$ib['id']}'>{$ib['name']}({$ib['rate']}%)</option>"; } echo"</select> <input type='submit' name='submit' value='Invest' /> </form> ok... Can anyone tell me why when I click Invest button, it redirects me to gym.php???? Form looks alright to me... There is no other code that would accept the form. But even without that code, should't it just refresh the same page??? Quote
Analog Posted May 13, 2011 Posted May 13, 2011 Without seeing the rest of the file the only thing I can come up with is maybe there is a form above that with an action to call gym.php Quote
lucky3809 Posted May 13, 2011 Posted May 13, 2011 Well your query is wrong how is it going to determine what user you are? You have it selecting from Everyones ibank... As for it redirecting you to the gym, it has nothing to do with that bit of code... Quote
Dayo Posted May 13, 2011 Posted May 13, 2011 have you got a open form before hand, try adding </form> before you start your bank.php form (this is a quick fix but you should find where it originates from and close the tag properly. And as said before you are selecting everything from ibank a better query would be SELECT `id`, `name`, `rate` FROM `ibank` WHERE `.....`='......' (fill in the dots with the userid fields) Quote
Analog Posted May 13, 2011 Posted May 13, 2011 I assumed ibank is storing info on how long the investment can be.. (ie 1 week at 2% interest, 2 weeks at 4.5%, etc....) Quote
galdikas Posted May 13, 2011 Author Posted May 13, 2011 (edited) Yeah, I bank just stores the length, rate, and timespan of investment :) So I need to select everything... And it is only 4 rows there, so not a major thing anywayy :) I found the problem.. It was as Dayo said... another form left open above :) Was half asleep yesterday :) Edited May 13, 2011 by galdikas Quote
Dominion Posted May 13, 2011 Posted May 13, 2011 <div id="main"> <form action="gym.php" method="post"> I just used ctrl+f to look for "gym.php" (line 28) Quote
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.