www.webdeveloper.com
Results 1 to 4 of 4

Thread: Problem in responsetext and if condition

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    Problem in responsetext and if condition

    Hi,

    Good day!

    I have a simple form for testing on displaying material data from barcode and I substr the value.

    for example the barcode = '10001CHE00102401100200250000.50'

    po_number = 10001
    item_code = CHE001
    supplier = 024
    uom = 01
    unique_id = 100200
    qty = 250000.50

    if the barcode has all its data or it has no problem or no missing info like po_number or item_code or the supplier from the database, it will display the information but if it is not match on the database data. I want to display a notification that the barcode is invalid.

    I attached my code, database and sample screenshots my problem is on displaying the notification .


    I tried to fix it but I can't figured out why it did not display.


    Thank you.
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    795
    Try this...

    In the getbarcode_data.php file, remove the "?>" at the end. PHP does NOT require you to close off their tag at the end of the file. This will prevent any tailing whitespaces that you may be receiving causing your comparison to fail.

    -OR-

    If doing this makes you uncomfortable, you could also "die" your results instead of echo'ing them (but this also terminates the script, and immediately passes back the output):

    PHP Code:
    die("Invalid Barcode");

    die(
    $po_number "^" $unique_id "^" $row["kind"] . "^" $row["item_code"] . "^" $row["supplier_code"] . "^" $row["dspi_uom"] . "^" $row["supplier"] . "^" $qty); 
    Obviously the first suggestion is what I would recommend, as I've been doing this for years.
    Last edited by bionoid; 10-08-2013 at 07:02 AM.

  3. #3
    Join Date
    Oct 2011
    Posts
    350
    Quote Originally Posted by bionoid View Post
    Try this...

    In the getbarcode_data.php file, remove the "?>" at the end. PHP does NOT require you to close off their tag at the end of the file. This will prevent any tailing whitespaces that you may be receiving causing your comparison to fail.

    -OR-

    If doing this makes you uncomfortable, you could also "die" your results instead of echo'ing them (but this also terminates the script, and immediately passes back the output):

    PHP Code:
    die("Invalid Barcode");

    die(
    $po_number "^" $unique_id "^" $row["kind"] . "^" $row["item_code"] . "^" $row["supplier_code"] . "^" $row["dspi_uom"] . "^" $row["supplier"] . "^" $qty); 
    Obviously the first suggestion is what I would recommend, as I've been doing this for years.
    Hi Sir,

    I tried all your suggestions, but still the Invalid Barcode display on the first textbox same output like on my sample images attached before.

    I attached my updated code.

    Thank you.
    Attached Files Attached Files

  4. #4
    Join Date
    Aug 2013
    Posts
    30
    what in deed was the wrong with the barcode ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles