Jump to content

Tunavis

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Tunavis

  1. It is supposed to edit and update info from a table. The problem is when I submit the changes nothing is changed...
  2. <?php include 'connect.php'; if(!isset($_POST['submit'])) { $q = "SELECT * FROM player_registration WHERE player_id = $_GET[player_id]"; $result = mysql_query($q); $person = mysql_fetch_array($result); } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0" cellpadding="5" cellspacing="0"> <tbody> <tr> <td>Name</td><td><input type="text" name="inputname" value="<?php echo $person['name']; ?>" /></td></tr><br /> <tr> <td>Surname</td><td><input type="text" name="inputsurname" value="<?php echo $person['surname']; ?>" /></td></tr><br /> <tr> <td>Contact Number</td><td><input type="text" name="inputcontact_num" value="<?php echo $person['contact_number']; ?>" /></td></tr><br /> <tr> <td>Email</td><td><input type="text" name="inputemail" value="<?php echo $person['email']; ?>" /></td></tr><br /> <tr> <td>Position</td><td><input type="text" name="inputpos" value="<?php echo $person['position']; ?>" /></td></tr><br /> <tr> <td>Username</td><td><input type="text" name="inputusername" value="<?php echo $person['username']; ?>" /></td></tr><br /> <tr> <td>Password</td><td><input type="text" name="inputpassw" value="<?php echo $person['password']; ?>" /></td></tr><br /> <tr> <td><input type="hidden" name="player_id" value="<?php echo $_GET['player_id']; ?>" /></td></tr> <tr> <td><input type="submit" name="submit" value="Submit" /></td></tr> </tbody> </table> </form> <?php if(isset($_POST['submit'])) { $u = "UPDATE player_registration SET `name`='$_POST[inputname], `surname`='$_POST[inputsurname], `contact_number`='$_POST[inputcontact]', `email`='$_POST[inputemail]', `position`='$_POST[inputpos]', `username`='$_POST[inputusername]', `password`='$_POST[inputpassw]' WHERE ID = $_POST[player_id]"; mysql_query($u) or die (mysql_error()); echo "User has been modified!"; } else { echo "Please fill out the form"; } ?>
×
×
  • 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.