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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.