Jump to content
MakeWebGames

Recommended Posts

Posted

<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???

Posted

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...

Posted

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)

Posted (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 by galdikas

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...