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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:53:17+00:00 2026-06-12T09:53:17+00:00

I’ve created a form for the user to fill out and on submit it

  • 0

I’ve created a form for the user to fill out and on submit it is processed and stuff is done with it. Usually just a database query.

With the database that I am working with, some fields can be NULL, so the user could leave something blank in some of the fields. However, when testing this, I tried having one or more fields empty, but the form wouldn’t really submit anything at all. When I was debugging, almost all the values of the fields, even the ones with text in it, turn out NULL when I retrieve the values from the POST method.

The thing is, I need to be able to allow the user to submit a form with some fields blank, as they are not completely necessary. How would I go about this?

Do I have to check isset() for everything that could be blank and set it to NULL if it is?

Thanks in advance!

EDIT: Here is the form code.

    <form onsubmit="return confirm('Are you sure you want to save the edits?');" method="post" action="orgedit.php?id=<?php echo $organization_id?>" id="orgform" name="orgform" >
Parent Organization ID: <input type="text" name="parent_id" value="<?php echo $row['parent_id']; ?>"/> <br /><br />
Organization nm: <input type="text" name="org_nm" value="<?php echo $row['org_nm']; ?>"/> <br /><br />
TBR Organization Sysnm: <input type="text" name="tbr_sysnm" value="<?php echo $row['tbr_sysnm']; ?>"/> <br /><br />
Type: <input type="text" name="type" value="<?php echo $row['type']; ?>"/> <br /><br />
Contact nm: <input type="text" name="contact_nm" value="<?php echo $row['contact_nm']; ?>"/> <br /><br />
Financial Info: <input type="text" name="financial_info" value="<?php echo $row['financial_info']; ?>"/> <br /><br />
Other Info: <input type="text" name="other_info" value="<?php echo $row['other_info']; ?>"/> <br /><br />
Active: <input type="text" name="active" value="<?php echo $row['active']; ?>"/> <br /><br />
URL: <input type="text" name="url" value="<?php echo $row['url']; ?>"/> <br /><br />
<input type="submit" value="Save Entry" name="save" />
</form>

and here is the php processing code 🙂

if(isset($_GET['id']))
    {
    $organization_id = $_GET['id'];
    $parent_organization_id = $_POST['parent_organization_id'];
    $organization_nm = $_POST['organization_nm'];
    $tbr_organization_sysnm = $_POST['tbr_organization_sysnm'];
    $type = $_POST['type'];
    $contact_nm = $_POST['contact_nm'];
    $financial_info = $_POST['financial_info'];
    $other_info = $_POST['other_info'];
    $active = $_POST['active'];
    $url = $_POST['url'];

After I get the values I simply escape them and perform a query.

I have figured out the problem!

if(isset($_GET['id']))
    {
    $organization_id = $_GET['id'];
    $parent_organization_id = $_POST['parent_id'];
    $organization_nm = $_POST['org_nm'];
    $tbr_organization_sysnm = $_POST['tbr_sysnm'];
    $type = $_POST['type'];
    $contact_nm = $_POST['contact_nm'];
    $financial_info = $_POST['financial_info'];
    $other_info = $_POST['other_info'];
    $active = $_POST['active'];
    $url = $_POST['url'];

I was retrieving the wrong values from the form. This could’ve been fixed by either changing the php code or the html code.

The problem is, the one or more fields empty issue still persists. If one of the fields is blank, the entry is not saved. I’ve checked the logs and the message it outputted was:

PHP Notice: Undefined index: parent_id
PHP Notice: Undefined index: org_nm
PHP Notice: Undefined index: tbr_sysnm

This happens when I don’t write anything for any of those fields and try to save the form.

EDIT 2: The problem was fixed once again. Did a var dump and found that the server wasn’t giving out anything when the code was trying to retrieve the values. It was a spelling mistake in a few of the 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-12T09:53:18+00:00Added an answer on June 12, 2026 at 9:53 am

    My first guess would be:

    Probably your form inputs don’t have a name attribute. Input data is only submitted if the input has a name attribute and the PHP $_POST key will be the name of the attribute.

    Let’s see OP’s code to see if my guess is correct.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have a text area in my form which accepts all possible characters from

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.