Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html public "-//W3C//DTD HTML 4.0 //EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Databases and Webprogramming: Assignment 4.1</title>
- </head>
- <body bgcolor="#f9f9f9">
- <?php
- // Read the name using either the $_GET or the $_POST variable
- $first_name = $_POST['first_name'] ;
- $last_name = $_POST['last_name'] ;
- $age = $_POST['age'] ;
- $con = mysqli_connect("localhost","root","","my_db")
- or die('Could not connect: ' . mysql_error());
- $query = "INSERT INTO student VALUES (\"" . $first_name . "\",\"" . $last_name . "\",\"" . $age . "\")";
- $result = mysqli_query($con, $query)
- or die('Error insert database.');
- echo "added";
- mysqli_close($con);
- ?>
- </p>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement