Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <title>
- Registration Form Car Spots Belgium
- </title>
- <style type="text/css">
- .container {
- background-color:gray;
- width:150px;
- border:2px solid black;
- font: 12px Verdana, sans-serif;
- }
- </style>
- </head>
- <body>
- <?php
- // If the form hasn't been submitted yet
- if (!isset($_POST['title'])) {
- // Echo the form. Customize this how you please
- echo "<form class=container method=post action=u.php >";
- echo "<td><tr>Title: <input type=text name=title> <div style= color:red;> Example: </br> Mercedes E250</div></td></tr><br>";
- echo "<td><tr>File Name: <input type=text name=password></td></tr><br>";
- echo "<input type=submit value=Insert>";
- echo "</form>";
- $date = date('d-m-Y');
- // If the form has been submitted
- }else{
- // FILL THIS IN WITH YOUR DATABASE INFO
- $db_host = 'localhost';
- $db_user = '*';
- $db_name = 'linh7219_shit';
- $db_pass = '*';
- $tbl_name = 'photos';
- // Connect to the database
- mysql_connect($db_host, $db_user, $db_pass) or die ('Cannot Connect Database');
- mysql_select_db($db_name) or die ('Cannot Select Database');
- // Randomly generate an id
- $id = rand();
- $name = $_POST['title'];
- // Run the query into the database
- mysql_query("INSERT INTO `".$tbl_name."` VALUES (".$id.", '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['password'])."', '".mysql_real_escape_string($date)."');");
- // Echo the complete message. Customize this as you please
- echo "Upload Complete <br>";
- echo "Succes, " . $name;
- }
- ?>
- </body>
Add Comment
Please, Sign In to add comment