Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:55:20+00:00 2026-05-23T12:55:20+00:00

I have been struggling through PHP and sqlite for a bit now and I’m

  • 0

I have been struggling through PHP and sqlite for a bit now and I’m just confusing myself.
I have an html form that accessess a php script called processFeedback.php.My html code looks like this..

<html>
<head>
</head>
<body>
<form action="processFeedback.php" method="POST">
    <table>
        <tr>
            <td>Name:</td><td><input name="name"/></td>
        </tr>
        <tr>
            <td>Email:</td><td><input name="email"/></td>
        </tr>
        <tr>
            <td>Comments:</td><td><textarea name="comments"></textarea></td>
        </tr>
        <tr>
            <td></td><td><input type="submit" value="Submit"/></td>
        </tr>
    </table>
</form>
</body>
</html>

and my php file looks like this…

<?php
try
{
//open the database
$db = new PDO('sqlite:feedback.db');

$name = $_POST["name"]; 
$email = $_POST["email"]; 
$comments = $_POST["comments"]; 

//Insert record  
$db->exec("INSERT INTO feedback (name, email,comments) VALUES ('&name', '&email','&comments');");

//now output the data to a simple html table...
print "<table border=1>";
print "<tr><td>Id</td><td>Name</td><td>Email</td><td>Comments</td></tr>";
$result = $db->query('SELECT * FROM feedback');
foreach($result as $row)
{
print "<tr><td>".$row['feedbackid']."</td>";
print "<td>".$row['name']."</td>";
print "<td>".$row['email']."</td>";
print "<td>".$row['comments']."</td>";
}

print "</table>";

$db = NULL;
}
catch(PDOException $e)
{
print 'Exception : ' .$e->getMessage();
}

?>

And here is my table creation method…

CREATE TABLE feedback (feedbackid INTEGER PRIMARY KEY,name TEXT,email TEXT,comments TEXT);

The form is outputting the table headers and also a record that I manually entered using the Terminal but it won’t insert a record in??? Can anyone see an easy mistake?

Disco

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:55:20+00:00Added an answer on May 23, 2026 at 12:55 pm

    //Insert record
    $db->exec(“INSERT INTO feedback (name, email,comments)
    VALUES (‘&name’, ‘&email’,’&comments’);”);

    One obvious issue is that you’re doing no error checking:

    if (1!=$db->exec(“INSERT…)) {
    print “Error: ” . implode(‘/’,$db->errorInfo()) . “
    \n”;
    }

    While I’m not overly familiar with PDO, I don’t see how your placeholders are getting mapped to the corresponding PHP variables – which is probably the cause of the error:

    $bound=array(
         $_POST["name"], $_POST["email"], $_POST["comments"] 
    );
    $stm=$db->prepare("INSERT INTO feedback (name, email,comments) 
       VALUES (?, ?,?));"
    
    if (!$stm || !$stm->execute($bound)) {
         print "Error: " . implode('/',$db->errorInfo()) . "<br />\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling with the best way to make sure that the certain
I've been struggling with Zend_Navigation all weekend, and now I have another problem, which
I have been struggling with this all day and have tried going through the
I have for the last several years been struggling to understand why the Internet
Have been looking at the MVC storefront and see that IQueryable is returned from
I've been a PHP developer for many years now, with many tools under my
I have been struggling with Subversion for some time, thinking it was beginners problems
I have been struggling trying to test a super simple EJB project in netbeans.
I have been struggling to get a simple autocomplete working with my Rails app
I have been struggling with this for the past hour and I was wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.