Jump to content

$_GET into Header


Cooper94

Recommended Posts

<?php include 'data.php' ?>
<?php
  // coonnect to database
  if (isset($_GET['id'])) {
    $sql = "SELECT username FROM pilots WHERE id='{$_GET['id']}'";
    if ($result = mysql_query($sql)) {
      $row = mysql_fetch_assoc($result);
    } else {
    echo "query failed ".mysql_error();
    }
  } else {
} 
?>
<?php 
$username = $_POST['username'];
$username = mysql_real_escape_string($username);

if(isset($_POST['submit'])) { 
mysql_query("UPDATE pilots SET username = '$username' WHERE id ='{$_GET['id']}'");
Header ('Location: acceptapp.php?id={$_GET['id']}');
}
?>
<?php
$sql="SELECT * FROM pilots ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$a = $row['username'];
echo "Last User: " . $a;
?>
<form action="set.php?id=<?php echo $_GET['id'] ?>" method="post">
<input type="text" name="username" value="RPA"><br>
<input type="submit" name="submit">
</form>

 

How would I make it echo out the id becuase I after I assign them a username than I want it to continue with the accept pilot proccess.

Link to comment
https://forums.phpfreaks.com/topic/146163-_get-into-header/
Share on other sites

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.