Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="mysql11.000webhost.com";
- $username="a4264749_will16";
- $password="billyjoe16";
- $db_name="a4264749_members";
- $con=mysql_connect("$host","$username","$password") or die("Could not connect to database");
- mysql_select_db("$db_name") or die ("Could not select Database.");
- //strip tags from values to prevent SQL Injections
- $compname=(strip_tags($_POST['compname']));
- $compdesc=(strip_tags($_POST['compdesc']));
- $compslog=(strip_tags($_POST['compslog']));
- //insert user stats into database
- $sql=("INSERT INTO `a4264749_members` . `company stats` ( `id`, `company name`, `company description`, `company slogan`, `cash`, `staff`, `factories`, `skill level`, `materials`, `machines`) VALUES ('NULL','$compname','$compdesc','$compslog', '100000000', '2000', '1','1','1000','10')");
- $result=mysql_query($sql);
- if (!$result)
- {
- echo "There was an error, please go back and try again";
- }
- else
- {
- echo "The company was successfully created";
- }
- mysql_close($con);
- ?>
- <html>
- <head>
- <style type="text/css">
- a:link {color:blue;text-decoration:none;}
- a:visited {color:blue;text-decoration:none;}
- a:hover {color:black;text-decoration:none;}
- </style>
- </head>
- <title> Create new company </title>
- <h1> Create new company </h1>
- <body>
- <body bgcolor="silver">
- </br>
- </hr>
- </br>
- <form action="insert.php" method="POST" >
- <p> Company Name: <input type="text" name="compname" value="" maxlength="40" /> </p> </br>
- <p> Company Description: <input type="fieldarea" name="compdesc" value="" maxlength="600" /></p></br>
- <p> Company Slogan: <input type="text" name="compslog" value="" maxlength="40" /></p></br>
- <input type="submit" name="submit" value="Create company" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement