KevHopwood Posted July 6, 2013 Share Posted July 6, 2013 hi all. Creating a cms and am adding an add page. my code for add.php is: <?php session_start(); include_once('../include/connection.php'); if (isset($_SESSION['logged_in'])){ if (isset($_POST['title'], $_POST['content'])) { $title = $_POST['title']; $content = nl2br($_POST['content']); $image = $_POST['Image URL']; $link = $_POST['Link']; $price = $_POST['Price']; if (empty($title) or empty($content)) { $error = 'All Fields Are Required!'; }else{ $query = $pdo->prepare('INSERT INTO apps (app_title, app_content, app_img, app_link, app_price) VALUES(?, ?, ?, ?, ?)'); $query->bindValue(1, $title); $query->bindValue(2, $content); $query->bindValue(3, $image); $query->bindValue(4, $link); $query->bindValue(5, $price); $query->execute(); header('location: index.php'); } } ?> <html> <head> <title>testing</title> <link rel="stylesheet" href="../style.css" /> </head> <body> <div class="container"> <a href="index.php" id="logo">CMS</a> <br /> <h4>Add Article</h4> <?php if (isset($error)) { ?> <small style="color:#aa0000;"><?php echo $error; ?></small><br /><br /> <?php } ?> <form action="add.php" method="post" autocomplete="off"> <input type="text" value="" name="title" placeholder="Title" /><br /><br /> <textarea rows="15" cols="50" value="" placeholder="Content" name="content"></textarea><br /><br /> <input type="text" value="" name="Image URL" placeholder="Image URL" /><br /><br /> <input type="text" value="" name="Link" placeholder="Link" /><br /><br /> <input type="text" value="" name="Price" placeholder="Price" /><br /><br /> <input type="submit" value="Add Article" /> </form> </div> </body> </html> <?php }else{ header('location: index.php'); } ?> my trouble is. it does not add to the database and there for I am unable to add content. can anyone see why? (cpanel error log is turned on and not telling me there is an error) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.