Could use some help
Posted: Sun Oct 06, 2013 8:11 pm
The code below trying to make
which you can see from the image into a Input where users can input whatever amount they want to buy or sell. With it those two line codes connect to the 5 items as its set up that way so the input box cant effect that the code for the complete transaction has to connect to them so if a user puts in 2 for each box the complete transaction button will know they bought a total of 10 items and it needs to know if its a buy or a sell that the user is asking as well as in case a user puts 1 for one item in buy and a 5 in sell for a item itll know that transaction. But i dont know how to do that lol I hope someone can help
* it cant effect the layout meaning ruining it.....so the box for input has to replace Buy 1/Sell 1*
Also it needs a loop.
It also needs to be able to validate that the user input was an integer
And that it was positive and between 1 and 9999
Code: Select all
echo "<td><a href=$PHP_SELF?action=buy&amount=1&gem=$i&price=$buyprice>Buy 1</a></td>";
echo "<td><a href=$PHP_SELF?action=sell&amount=1&gem=$i&price=$buyprice>Sell 1</a></td>";* it cant effect the layout meaning ruining it.....so the box for input has to replace Buy 1/Sell 1*
Code: Select all
$gemname=$stockdata[gemname][$i];
$saleprice=ceil($stockdata[baseprice][$i]*(1+$spread));
$buyprice=ceil($stockdata[baseprice][$i]*(1-$spread));
$amount=$stockdata[amount][$i];
echo "<tr><td align=center>$gemname</td><td align=center>$saleprice</td><td align=center>$buyprice</td>";
if ($playerinfo[status]==5) echo "<td align=center>$amount</td>";
echo "<td><a href=$PHP_SELF?action=buy&amount=1&gem=$i&price=$buyprice>Buy 1</a></td>";
echo "<td><a href=$PHP_SELF?action=sell&amount=1&gem=$i&price=$buyprice>Sell 1</a></td>";
echo "<td>$amount</a></td>";
echo "</tr>";
}
echo "</table>";
echo(' <p><center><input name="Submit" type="button" value="Complete Transaction" class="button" /></center></p>'); Also it needs a loop.
It also needs to be able to validate that the user input was an integer
And that it was positive and between 1 and 9999