Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>Counter</title>
- <link rel="stylesheet" src="css/style.css">
- </head>
- <body>
- <output id="output">
- </output>
- <div id="">
- <form name="form" action="" method="post">
- <input type="text" name="counter_input" id="counter-input">
- <input type="submit" value="Submit" class="submit">
- </form>
- <?php
- if (isset($_POST['counter_input'])) {
- $counter_input = $_POST['counter_input'];
- if (!empty($counter_input)) {
- $con = mysql_connect('localhost', 'ryan_main', '***************');
- if (!$con) {
- die("Not Connected:" . mysql_error());
- } else {
- $select_db = mysql_select_db("ryan_counter", $con);
- if (!select_db) {
- die("Not Connected:" . mysql_error());
- } else {
- mysql_query("INSERT INTO main_table(number) VALUES ('$counter_input')");
- mysql_close($con);
- echo 'I think it worked';
- }
- }
- } else {
- echo "You have to enter a number first";
- }
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement