seany123 Posted May 3, 2009 Share Posted May 3, 2009 i don't really know exactly how to explain the help I need. basically in this game im making i have this page... <?php include("lib.php"); define("PAGENAME", "Transfer Points"); $player = check_user($secret_key, $db); $username = ($_GET['username']); $amount = ($_GET['amount']); if (isset($_GET['username']) && ($_GET['amount']) && ($_GET['submit'])) { $query = $db->execute("select `id`, `username`, `points` from `players` where `username`like '$username'"); $member = $query->fetchrow; if ($query->recordcount() == 0) { include("templates/private_header.php"); echo "<p />This player doesn't exist!<p />"; echo "<a href=\"transfer.php\">Transfer Again</a><p />"; include("templates/private_footer.php"); exit; } else if ($player->points < $amount ) { include("templates/private_header.php"); echo "<p />You cannot send this amount of points!<p />"; echo "<a href=\"transfer.php\">Transfer Again</a><p />"; include("templates/private_footer.php"); exit; } else if (!is_numeric($amount)) { include("templates/private_header.php"); echo "<p />You cannot send this amount of points!<p />"; echo "<a href=\"guild_treasury.php\">Transfer Again</a><p />"; include("templates/private_footer.php"); exit; } else if ($amount < 0 ) { include("templates/private_header.php"); echo "<p />You cannot send this amount of points!<p />"; echo "<a href=\"transfer.php\">Transfer Again</a><p />"; include("templates/private_footer.php"); exit; } else { while ($member = $query->fetchrow()) { //Logging Feature //$pointslog = "pointslog.txt"; //$input = fopen($pointslog, 'a') or die("Cannot Open File."); //$stringData = "$player->username transferred $amount points to $username.\n"; //fwrite($input, $stringData); //fclose($input); $query = $db->execute("update `players` set `points`=? where `username`=?", array($member['points'] + $amount, $username)); $query1 = $db->execute("update `players` set `points`=? where `id`=?", array($player->points - $amount, $player->id)); $logmsg = "You were given <b>$amount points</b> by $player->username."; addlog($member['id'], $logmsg, $db); include("templates/private_header.php"); echo "<p />You have transferred <b>$amount points</b> to $username.<p />"; echo "<a href=\"home.php\">Home</a><p />"; include("templates/private_footer.php"); exit; } } } include("templates/private_header.php"); ?> <fieldset> <p /> <legend><b>Transfer points</b></legend> <p><form method="GET" action="transferpoints.php"> <input type="text" name="username" value="Username" size="20"/><br /> <input type="text" name="amount" value="points" size="20"/><p /> <input type="submit" name="submit" value="Submit"> </form> </fieldset> <?php include("templates/private_footer.php"); ?> i want a way to instead of once on the page you type in the players username... that the players username is already selected... i thought by using some kind of thing like transfer.php?username=(there name) but i seriously dont know how to go about doing that... and then how to use username= again in a query. Link to comment https://forums.phpfreaks.com/topic/156699-solved-little-help-with-_get-_post-etc/ Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 $_GET['username'] would get it. But you already have that, so I don't really get the problem. I guess you can wrap the entire block above with: if (isset($_GET['submit'])) { Link to comment https://forums.phpfreaks.com/topic/156699-solved-little-help-with-_get-_post-etc/#findComment-825139 Share on other sites More sharing options...
seany123 Posted May 3, 2009 Author Share Posted May 3, 2009 currently... i got onto this page using transfer.php... from there i then have to input the username and value. i want it so, when i got to this url... transfer.php?username=.... then i just have to insert the value to run the query. Link to comment https://forums.phpfreaks.com/topic/156699-solved-little-help-with-_get-_post-etc/#findComment-825174 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Try http://mydomain.com/transfer.php?submit=submit&username=something&amount=someamount You need submit and amount in the URL. Link to comment https://forums.phpfreaks.com/topic/156699-solved-little-help-with-_get-_post-etc/#findComment-825177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.