Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username=$_POST['username'];
- $password=$_POST['password'];
- $gender=$_POST['gender'];
- $reference=$_POST['reference'];
- $mailing_list=$_POST['mailinglist'];
- if($mailing_list=='yes')
- $mailing_list=1;
- elseif($mailing_list==null)
- $mailing_list=0;
- $db=mysqli_connect('localhost','root','','userregistration');
- $sql="INSERT INTO user_information
- (username,password,gender,reference,mailing_list)
- VALUES ('$username', '$password', '$gender', '$reference','$mailing_list');";
- mysqli_query($db,$sql);
- echo 'USER SUCCESSFULLY ADDED';
- header('Location:display.php');
- ?>
- <html>
- <head>
- <title>USER RECORDS</title>
- <link rel="stylesheet" type="text/css" href="exer2Style.css"></head>
- <body>
- <table border=1>
- <?php
- $ths=array('USERNAME','PASSWORD','GENDER','REFERENCE','MAILING LIST');
- foreach($ths as $data){
- ?>
- <th><?php echo $data;
- }?></th>
- <?php
- $db=mysqli_connect('localhost','root','','userregistration');
- $sql="SELECT * FROM user_information";
- $result=mysqli_query($db,$sql);
- while($row=mysqli_fetch_array($result)){;
- echo "<tr><td>".$row['username']."</td>".
- "<td>".$row['password']."</td>".
- "<td>".$row['gender']."</td>".
- "<td>".$row['reference']."</td>".
- "<td>".$row['mailing_list']."</td></tr>";
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement