Note that there are some explanatory texts on larger screens.

plurals
  1. POtable not adding to database
    primarykey
    data
    text
    <p>I am currently creating my site and have come to a point where I am to add content to my database</p> <p>my add.php code is this:</p> <pre><code> &lt;?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-&gt;prepare('INSERT INTO apps (app_title, app_content, app_img, app_link, app_price) VALUES(?, ?, ?, ?, ?)'); $query-&gt;bindValue(1, $title); $query-&gt;bindValue(2, $content); $query-&gt;bindValue(3, $image); $query-&gt;bindValue(4, $link); $query-&gt;bindValue(5, $price); $query-&gt;execute(); header('location: index.php'); } } ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;testing&lt;/title&gt; &lt;link rel="stylesheet" href="../style.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;a href="index.php" id="logo"&gt;CMS&lt;/a&gt; &lt;br /&gt; &lt;h4&gt;Add Article&lt;/h4&gt; &lt;?php if (isset($error)) { ?&gt; &lt;small style="color:#aa0000;"&gt;&lt;?php echo $error; ?&gt;&lt;/small&gt;&lt;br /&gt;&lt;br /&gt; &lt;?php } ?&gt; &lt;form action="add.php" method="post" autocomplete="off"&gt; &lt;input type="text" value="" name="title" placeholder="Title" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;textarea rows="15" cols="50" value="" placeholder="Content" name="content"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="text" value="" name="Image URL" placeholder="Image URL" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="text" value="" name="Link" placeholder="Link" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="text" value="" name="Price" placeholder="Price" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="submit" name="submit" value="Add Article" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php }else{ header('location: index.php'); } ?&gt; </code></pre> <p>it loads ok and works file on the display but it does not add the info to my database called apps.</p> <p>please can someone tell me why? </p> <p>thank you. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload