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.

What does getbarcode_data.php output when you use a normal (non-ajax) post form to submit invalid barcode data?
Does it show “Invalid Barcode” or does it show delimited data?

If it still shows delimited data, then the PHP logic needs to be worked on.

If it shows “Invalid Barcode”, then it’s likely to be the closing PHP tag causing you trouble, resulting in a newline after the text too. A good solution for that is to remove the closing PHP tag from the PHP script.

Either way, it seems to be a PHP issue that is being dealt with here - so I’ll move things across to that forum for the meantime.

It shows Invalid Barcode

You mean this Sir ?>

I attached the updated testing.php

Thank you

I tried to remove the ?>
but still same output. the Invalid Code display on the textbox of PO Number instead of notification box.

Thank you