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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:54:59+00:00 2026-06-13T05:54:59+00:00

I made a PHP site that uses MySQLi with basic functionality to submit an

  • 0

I made a PHP site that uses MySQLi with basic functionality to submit an HTML5 form into my database. The problem is that it will only insert into the database if ALL fields have been completed. How can I make it so that I can leave some fields blank, but have it work properly for the rest?

//connection statements above

$first=$_POST['first'];
$last=$_POST['last'];
$signed=$_POST['signed'];
$cardnumb=$_POST['cardnumb'];
$perm=$_POST['permcard'];

$stmt = $mysqli->prepare("INSERT INTO information (first_name, last_name, signed, number, permanent) VALUES (?,?,?,?,?)");

$stmt->bind_param("sssss", $first, $last, $signed, $cardnumb, $perm);
$stmt->execute();
$stmt->close();

Just to be clear, this code works perfectly fine if ALL fields have been filled out. It DOES NOT work if a field is left empty.

Is there a way to make this work with empty fields?

  • 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-13T05:55:00+00:00Added an answer on June 13, 2026 at 5:55 am

    If you don’t fill out the field does the $_POST['varname']; return null or an empty string?

    If its an empty string this should still work fine.

    If its null then it should work as long as the fields are allowed to be null in the database.

    Check your table scheme and make sure the fields are allowed to be null.

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

Sidebar

Related Questions

I've just made some fixes to a web site that uses the Form2Mail PHP
I have a contact form made with php on my website. The problem is
I have a PHP site with a mySQL database that I'm working on. I'm
I have a database class that I made that uses PDO to connect to
I have a PHP/MySQL e-commerce site that is placing order detail information into a
I have made a site with classic php and mysql functions. I order to
site.com/link?p=2 give $_GET['p']==2 even though i've already made site.com/link rewrite to site.com/index.php?page=link So, i'm
I've made a php script, that has the job to print text on a
I have made a php page that sends an email message with multiple attachments.
I made a little PHP script that checks if an email is valid. The

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.