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

  • Home
  • SEARCH
  • 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 9210939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:11:13+00:00 2026-06-18T01:11:13+00:00

I am trying to create a form in which a logged in user can

  • 0

I am trying to create a form in which a logged in user can enter a sale (ltd_entry_amount), but only sales that are $200.00 or more, but with no luck. If I get rid of the ‘> 199.99’ the form works ok but for now the ‘Please check all manatory fields are complete and try again.’ message shows. Can anyone help?

                <?php 

                require_once ('./includes/config.inc.php');

                $page_title = 'Log a Sale';
                include ('./includes/header.html');

                if (!isset($_SESSION['ltd_user_id'])) {

                   $url = 'http://' . $_SERVER['HTTP_HOST']
                    . dirname($_SERVER['PHP_SELF']);
                   if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
                        $url = substr ($url, 0, -1); // Chop off the slash.
                   }
                   $url .= '/login.php'; 

                ob_end_clean(); // Delete the buffer.
                header("Location: $url"); 
                exit(); // Quit the script.
                }
                $users = $_SESSION['ltd_user_id'];

                if (isset($_POST['submitted'])) {// Handle the form.

                   require_once ('database.php');
                   // Connect to the database.    

                    $errors = array(); // Initialize error array.

                    // Check for a Invoice Number.
                    if (empty($_POST['ltd_invoice_no'])) {
                       $errors[] = '<p>• You forgot to enter your Invoice Number.</p>';
                    } else {
                       $inv = escape_data($_POST['ltd_invoice_no']);
                    }

                    // Check for invoice amount.
                    if (empty($_POST['ltd_entry_amount']) < 199.99) {
                       $errors[] = '<p>• You forgot to enter your Total Amount. Please ensure it is at least $200.00</p>';
                    } else {
                       $amount = escape_data($_POST['ltd_entry_amount']);
                    }

                    // Check for business name.
                    if (empty($_POST['ltd_business_name'])) {
                       $errors[] = '• You forgot to enter your Dealership Name.';
                    } else {
                       $dealer = escape_data($_POST['ltd_business_name']);
                    }

                    if (empty($errors) && $amount)  { // If everything's OK. // If everything's OK.

                      // Make sure the invoice number is available.
                      $uid = @mysql_insert_id(); //Get the url ID.

                        // Add the user.
                        $query = "INSERT INTO ltd_sales_list (ltd_item_id , ltd_user_id, ltd_invoice_no, ltd_entry_amount, ltd_entry_userdate, ltd_business_name, ltd_entry_date) VALUES
                        ('$uid', '$users', '$inv', '$amount', '$_POST[ltd_entry_userdate]', '$dealer' , NOW())";
                        $result = @mysql_query ($query); // Run the query.


                        if (mysql_affected_rows() == 1) {
                        // If it ran OK.
                           echo 'Your sale is registered into the system.';
                           include ('./includes/footer.html'); // Include the HTML footer.
                           exit();

                        } else { // If it did not run OK.
                           echo 'You could not be registered due to a system error. We apologize for any inconvenience.';
                        }

                   } else { // If one of the data tests failed.
                      echo 'Please check all manatory fields are complete and try again.';
                   }

                   mysql_close(); // Close the database connection.

                } // End of the main Submit conditional.
                ?>                          


                <form action="logsale.php" method="post">



                                        <table width="550" border="0" cellspacing="1" cellpadding="5">

                                              <tr>
                                                <td width="250"><div align="right">Invoice Number <span class="red_light">*</span></div></td>
                                                <td width="267">
                                                <input type="text" name="ltd_invoice_no" size="30" maxlength="30" value="<?php if (isset($_POST['ltd_invoice_no'])) echo $_POST['ltd_invoice_no']; ?>" /></td>
                                              </tr>
                                              <tr>
                                                <td><div align="right">Total Amount of sale 
                                                        <em><strong>(exc. GST)</strong></em> <span class="red_light">*</span></div></td>
                                                <td>
                                                <input type="text" name="ltd_entry_amount" size="30" maxlength="30" 
                                                value="<?php if (isset($_POST['ltd_entry_amount'])) echo $_POST['ltd_entry_amount']; ?>" /></td>
                                              </tr>
                                              <tr>
                                                <td></td>
                                                <td>Please enter number only</td>
                                              </tr>
                                              <tr>
                                                <td><div align="right">Date of Invoice</div></td>
                                                <td>
                                                <script type="text/javascript">
                                                    $(function() {
                                                    $("#datepicker").datepicker({ dateFormat: "dd/mm/yy" }).val()
                                                    });
                                                    </script>

                                                <input size="30" maxlength="10" id="datepicker" name="ltd_entry_userdate" type="text" value="<?php if (isset($_POST['ltd_entry_userdate'])) echo $_POST['ltd_entry_userdate']; ?>" /></td>

                                              </tr>
                                                <tr>
                                                <td></td>
                                                <td><span class="sml_italics"><strong>Please enter as <strong>DD-MM-YYYY</strong></td>
                                              </tr>
                                              <tr>
                                                <td><div align="right">Dealership <span class="red_light">*</span></div></td>
                                                <td><input type="text" name="ltd_business_name" size="50" maxlength="60" value="<?php if (isset($_POST['ltd_business_name'])) echo $_POST['ltd_business_name']; ?>" /></td>
                                               </tr> 

                                                <tr>
                                                <td></td>
                                                <td><p><input type="submit" name="submit" value="Submit" /></p><input type="hidden" name="submitted" value="TRUE" />
                                                </td>
                                                </tr>

                                            </table>


                  </form>


                 <?php
                include ('./includes/footer.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-18T01:11:14+00:00Added an answer on June 18, 2026 at 1:11 am

    if (empty($_POST[‘ltd_entry_amount’]) < 199.99) {

    You are comparing a boolean value with a float number

    You must separate both conditions:

    if(empty($_POST[‘ltd_entry_amount’]) or $_POST[‘ldt_entry_amount’] < 199.99){

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

Sidebar

Related Questions

I'm trying to create a form which can be cancelled. I found that the
I am trying to create a simple GUI form which has only 2 elements
i'm trying to create form which with which i can upload text and image
I'm trying to create a form which contains a radio button that maps to
I am trying to create a form that takes only a single letter and
I'm trying to create a form which allows the user to define own custom
I am trying to create a form which loads upon a user clicking a
im trying to create a semi-transparent form which is displayed in a panel. i
I'm trying to create a custom form element which extends Zend_Form_Element_Text with a validator
I'm trying to create a simple form with two different submit buttons: one which

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.