Hello,
I need some help on my PHP coding. I need the ?=ID to show up on the URL when the user logs in and then to be able to use GET['id'] to show the results (first name, surname, dob etc).
Below is my coding I have so far:
Heading.php - this is where the user will log in.
<div id="heading"> <h2>Sports Pal</h2> <h5>Playing the same sport as you!</h5> <h5><a href="@">Home</a>: <a href="@">About</a>: <a href="@">Contact</a>: <a href="@">Advertise</a></h5> <div class="signin"> <?php if ($_SESSION['loggedin'] == true){ echo "<p>You are logged in.</p>\n"; }else{ echo "<p>Sign In:</p>\n"; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Username: <input type="text" name="liusername"> Password: <input type="password" name="lipassword"> <input type="submit" name="lisubmit" value="Sign In"> </form> </div> </div>
Source code on profile.php
<?php include "./includes/nav.php"; ?> <div id="content"> <h3>User Profile</h3> <?php $query="SELECT user_id, user_firstname, user_surname, user_dob, user_gender FROM user"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); if ($_GET['id'] == $_SESSION['id']); //if (isset($_GET['id'])){ //$_GET['id'] == $_SESSION['id']; echo "<label>First Name: </label>"; echo $row['user_firstname']."<br />"; echo "<label>Surname: </label>"; echo $row['user_surname']."<br />"; echo "<label>Date of Birth: </label>"; echo $row['user_dob']."<br />"; echo "<label>Gender: </label>"; echo $row['user_gender']."<br />"; echo "<label>City: </label>"; ?> <br /> </div>
Many thanks for your help