Here is all my code.
checkInfo.php
Code:<?php include ("config.php"); ?> <!doctype html> <html> <head> <title>check</title> </head> <body>asdfasdf <?php $contentOfPost=$_POST['contentOfPost']; $submit=$_POST['submit']; $date = date("Y/m/d"); $time = time(); echo $date; echo $time; echo $submit; echo "<br />"; echo $contentOfPost; $link = mysql_connect($host, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } else{ echo 'Connected successfully'; $insertionToDatabase=INSERT INTO userSubmitted ('PostNumber', 'Date', 'Time', 'Content') VALUES (NULL, '$date', '$time', '$contentOfPost'); mysql_close($link); } ?> </body> </html>
config.php
Code:<?php $host="mysql"; $username="thisisnthere"; $password="thisisfalse"; ?>
blog.php
Code:<?php session_start(); ?> <!doctype html> <html> <head> <title>blog</title> <style type="text/css"> </style> </head> <body> <?php session_start(); $_SESSION['views'] = 1; // store session data if(isset($_SESSION['views'])) $_SESSION['views'] = $_SESSION['views']+ 1; else $_SESSION['views'] = 1; echo "views = ". $_SESSION['views']; ?> <form action="checkInfo.php" method="post"> <textarea name="contentOfPost"> </textarea> <input type="submit" value="Submit Blog" name="submit" /> </form> </body> </html>
Basically this was working except when I tried to write the user submitted post into the database. No errors appear or anything, just a blank page. I've written some if/else statements to try and just get ANYTHING to appear but it's a no go. What am I missing?
I know that the sql connection is correct because I've tested it before.




Reply With Quote



Bookmarks