Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <br/>
- <form action="action_test.php" method="post">
- First Name <input type="textbox" name="fname"><br/>
- Last Name <input type="textbox" name="lname"><br/>
- age <input type="textbox" name= "age"><br/>
- Username <input type="textbox" name= "user"><br/>
- Password <input type="password" name= "pass"><br/>
- <input type="submit" value="submit">
- </form>
- <?php
- $user=$_POST['user'];
- $pass=$_POST['pass'];
- $fname=$_POST['fname'];
- $lname=$_POST['lname'];
- $age=$_POST['age'];
- $con = mysql_connect("localhost",$user,$pass);
- if (!$con){
- die("Wrong Password");
- }
- mysql_select_db("my_db", $con);
- mysql_query("INSERT INTO Persons (FirstName, LastName, Age)
- VALUES ($fname, $lname, $age)
- "
- );
- $result = mysql_query("SELECT * FROM Persons");
- echo "<table border='1'>
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- <th>Age</th>
- </tr>";
- while($row = mysql_fetch_array($result))
- {
- echo "<tr>";
- echo "<td>" . $row['FirstName'] . "</td>";
- echo "<td>" . $row['LastName'] . "</td>";
- echo "<td>" . $row['Age'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement