Jump to content

[SOLVED] Administration Page


echoed

Recommended Posts

On my administration page i want to be able to easily update hockey statistics and such ,this is just a small example portion of what the page will be but after i get this to work i should be able to finish the rest.

 

 

 

When i click on the + or - i want it to Update the goals and either add or subtract 1 to the entry.

 

 

My Form

<html>
<body>
<form name="form" method="post" action="process_update_player.php">
Player: <input type="text" name="player"><br />
Goals<input type="submit" name="g_add" value="+"><input type="submit" name="g_subtract" value="-"><br>

</form>
</body>
</html>

 

My php code(process_update_player.php)

<?php
$player = $_POST['player'];
$add = 1;
$subtract = 1;
$conn=mysql_connect("localhost","****","********");
mysql_select_db("***********");
if(isset($_POST['g_add'])){
$query="UPDATE `mklseason5` SET `season_goals` += `$add` WHERE `player` = `$player`";
mysql_query($query) or die("Cannot add");
echo "succesfully added goal to ". $player;
}
if(isset($_POST['g_subtract'])){
$query="UPDATE `mklseason5` SET `season_goals` -= `$subtract` WHERE `player` = `$player`";
mysql_query($query) or die("Cannot subtract");
echo "succesfully subtracted goal to ". $player;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/153053-solved-administration-page/
Share on other sites

That really doesn't give me anything to work with!!!

 

So in reply!

It should be!

 

Still not working =\.

 

<?php
$player = $_POST['player'];

$conn=mysql_connect("****","**********","********");
mysql_select_db("******");
if(isset($_POST['g_add'])){
$query="UPDATE `mklseason5` SET `season_goals` = `season_goals`+1 WHERE `player` = `$player`";
mysql_query($query) or die("Cannot add");
echo "succesfully added goal from ". $player;
}
if(isset($_POST['g_subtract'])){
$query="UPDATE `mklseason5` SET `season_goals` = `season_goals`-1 WHERE `player` = `$player`";
mysql_query($query) or die("Cannot subtract");
echo "succesfully subtracted goal from ". $player;
}
?>

 

Also tried Ashoar's advice and it doesn't work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.