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 8574557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:30:03+00:00 2026-06-11T19:30:03+00:00

I’m unable to insert a record here. Not sure why. My login works. My

  • 0

I’m unable to insert a record here. Not sure why. My login works. My two echo statements work. But no record gets recorded. All the variables that begin with ‘type’ or ‘subj’ are checkbox form elements, so I set those columns to ‘Null’ in the db (using phpMyAdmin). Not sure if that’s correct – the idea is they’re not required. Also, the first column in my db is not an entry from this form, it’s supposed to be an id for the entry, set as primary key, not-null, and set to auto-increment. This is my first time doing this. How can I test what’s happening? Thank you! – and what the heck happened to my codeblock!!!

    <!DOCTYPE html>
    <head>
    <title>Submit entry to database </title>
    </head>
    <body>  <?php
    //when Submit clicked
    if ( isset($_POST['submit']) ){
    $data_source = 'mysql:host=myHost;dbname=myDatabase';
    $db_user = 'myUserName';
    $db_password = 'myPassword';
    $db = new PDO($data_source, $db_user, $db_password);

    //load the form data into variables
    $reviewer = $_POST['reviewer'];
    $osj = $_POST['osj'];
    $touchDate = $_POST['touchDate'];
    $typeAction = $_POST['typeAction'];
    $typeTech = $_POST['typeTech'];
    $typeReg = $_POST['typeReg'];
    $subjSuit = $_POST['subjSuit'];
    $subjMFtran = $_POST['subjMFtran'];
    $subjConcen = $_POST['subjConcen'];
    $subjOption = $_POST['subjOption'];
    $subjTrade = $_POST['subjTrade'];
    $subjMuni = $_POST['subjMuni'];
    $subjUIT = $_POST['subjUIT'];
    $subjBkRecMFdir = $_POST['subjBkRecMFdir'];
    $subjOBA = $_POST['subjOBA'];
    $subjOther = $_POST['subjOther'];
    $flavor = $_POST['flavor'];
    $notes = $_POST['notes'];
    echo $reviewer;
    //prepare SQL statement
    $statement = "INSERT INTO tblBranchTouches 
    (reviewer, osj, touchDate, typeAction, typeTech, typeReg, subjSuit, 
    subjMFtran, subjConcen, subjOption, subjTrade, subjMuni, subjUIT, subjBkRecMFdir, 
    subjOBA, subjOther, flavor, notes) 
    VALUES ('$reviewer', '$osj', '$touchDate', '$typeAction', '$typeTech', '$typeReg', '$subjSuit', 
    '$subjMFtran', '$subjConcen', '$subjOption', '$subjTrade', '$subjMuni', '$subjUIT', '$subjBkRecMFdir', 
    '$subjOBA', '$subjOther', '$flavor', '$notes') ";
    $db->query($statement);
    //confirm
    echo "<h1>Thank You</h1>";
    }
    ?>
    <form method="post">
    <p>
    <label>
      Reviewer: 
      <input type="text" name="reviewer" list="ARTies">
      <datalist id="ARTies">
        <option value = "MWeber">
        <option value = "JBurchill">
        <option value = "DGlazer">
        <option value = "EKiburz">
        <option value = "CSupak">
        <option value = "MVallery">
        <option value = "CHo">
        <option value = "HPatil">
        <option value = "NVanDoorn">
      </datalist>
    </label>
    <label>
      OSJ: 
      <input type="text" name="osj" maxlength=3 size=3>
    </label>
    <input type="date" name="touchDate" value="<?php echo date('Y-m-d', strtotime(date('Y/m/d'))); ?>">
    </p>
    <fieldset>
    <legend>Type: </legend>
    <p><label><input type="checkbox" name="typeAction"> Action </label>
    <label><input type="checkbox" name="typeTech"> Tech. </label>
    <label><input type="checkbox" name="typeReg"> Reg.</label></p>
    </fieldset>
    <fieldset>
    <legend>Subject: </legend>
    <p>
    <label><input type="checkbox" name="subjSuit"> Suitability </label>
    <label><input type="checkbox" name="subjMFtrans"> MF Transactions </label>
    <label><input type="checkbox" name="subjConcen"> Concentrations </label>
    <label><input type="checkbox" name="subjOption"> Options </label>
    <label><input type="checkbox" name="subjTrade"> Trade Review </label>
    <label><input type="checkbox" name="subjMuni"> Munis </label>
    <label><input type="checkbox" name="subjUIT"> UITs </label>
    <label><input type="checkbox" name="subjBkRecMFdir"> Bks-Recs-MFDirect </label>
    <label><input type="checkbox" name="subjOBA"> OBAs  </label>
    <label><input type="checkbox" name="subjOther"> Other </label>
    </p>
    </fieldset>
    <p>
    <label>
      Flavor: 
      <input type="number" name="flavor" min=1 max=5 value=3>
    </label>
    <label>Notes: <textarea name="notes"></textarea></label>
    </p>
    <p>
    <input type="submit" name="submit" value="ENTER">
    </p>
    </form>
    </body>
    </html>
  • 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-06-11T19:30:04+00:00Added an answer on June 11, 2026 at 7:30 pm

    Here’s what is now working for me. I just wish I didn’t have to write my form variables about 7 different times. Thanks again…

    <?php
    //when Submit clicked
    if ( isset($_POST['submit']) ){
      $data_source = 'mysql:host=myHost;dbname=myDB';
      $db_user = 'myUsername';
      $db_password = 'myPass';
      //create a new PDO object - constructor takes at most 4 parameters, DSN, username, password, 
      //and an array of driver options
      //a DSN is basically a string of options that tell PDO which driver to use, and the connection details
      $conn = new PDO($data_source, $db_user, $db_password, 
                    array(PDO::ATTR_EMULATE_PREPARES => false, 
                          PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
      //first driver option turns off prepare emulation which is enabled in MySQL driver by default, but really should be turned off to use PDO safely
      //second driver option puts PDO into exception mode
      //
      //load the form data into variables
      $reviewer = $_POST['reviewer'];
      //(more)      
      //prepare SQL statement
      $sql="INSERT INTO tblBranchTouches 
        (reviewer, osj, touchDate, typeAction, typeTech, typeReg, subjSuit, 
        subjMFtrans, subjConcen, subjOption, subjTrade, subjMuni, subjUIT, subjBkRecMFdir, 
        subjOBA, subjOther, flavor, notes) 
        VALUES (:reviewer, :osj, :touchDate, :typeAction, :typeTech, :typeReg, :subjSuit, 
        :subjMFtrans, :subjConcen, :subjOption, :subjTrade, :subjMuni, :subjUIT, :subjBkRecMFdir, 
        :subjOBA, :subjOther, :flavor, :notes)";
      $q = $conn->prepare($sql);  
      $q->execute(array(':reviewer'=>$reviewer, ':osj'=>$osj, ':touchDate'=>$touchDate, ':typeAction'=>$typeAction, ':typeTech'=>$typeTech, 
                       ':typeReg'=>$typeReg, ':subjSuit'=>$subjSuit, ':subjMFtrans'=>$subjMFtrans, ':subjConcen'=>$subjConcen, ':subjOption'=>$subjOption, 
                       ':subjTrade'=>$subjTrade, ':subjMuni'=>$subjMuni, ':subjUIT'=>$subjUIT, ':subjBkRecMFdir'=>$subjBkRecMFdir, ':subjOBA'=>$subjOBA, 
                       ':subjOther'=>$subjOther, ':flavor'=>$flavor, ':notes'=>$notes));
    }
    

    ?>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I've tracked down a weird MySQL problem to the two different ways I was
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

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.