Jump to content

Trying to add a barcode to my page


Go to solution Solved by hansford,

Recommended Posts

I want to add Javascript called encode() and show below my results of my page.

the barcode should be of $Serial

 

The page works but I do not get a barcode....I don't  get any error. This is my first time to try to add a javascript to php

 



<html>
<head>
<title>Status Screen</title>



</head>

<body>
<?php

include 'db.php';
$serial='14417504017';
?>

<link rel="StyleSheet" href="barcode.css" type="text/css" />
<script src="barcode.js"></script>
<script type="text/javascript">
function encode()
{
var strValue = document.getElementById("$serial").value;
var strBarcodeHTML = code128(strValue);
document.getElementById("barcode").innerHTML = strBarcodeHTML;
}
</script>
</head>
<?php

//=$_GET["id"];
$connect =odbc_connect("removed");
if(!$connect) {
exit("Connection Failed: " . $connect);
}

$sql = $sql_redtag_select;
$sql .= $sql_case1;
$sql .= $sql_truck;
$sql .= " FROM WIP_master
left join m1_DC.dbo.SalesOrders on m1_DC.dbo.SalesOrders.ompSalesOrderID=OrbeData_KithKitchens.dbo.WIP_master.ompSalesOrderID
left join m1_DC.dbo.UTRUCK ON m1_DC.dbo.UTRUCK.UTRTRUCKNUMBER=m1_DC.dbo.SalesOrders.UOMPTRUCKNUMBER
where OrbeData_KithKitchens.dbo.WIP_master.serial='$serial' and (OrbeData_KithKitchens.dbo.WIP_master.status not in ('1','25','50'))
and( redtag='Y' and redtagclosed !='Y'
or (redtag='N' and m1_DC.dbo.SalesOrders.uompschedulenumber like 'S%' and m1_DC.dbo.SalesOrders.ompclosed <> -1 ) )
order by OrbeData_KithKitchens.dbo.WIP_master.uompschedulenumber,uomlSorP,upsdescription,jmaPartID ";


$result =odbc_exec($connect,$sql);
if(!$result){
exit("Error in SQL");
}





?>
<div class="barcode" id="barcode"></div>


<?php
include ("redtag_serial_results.php");
odbc_close($connect);

echo "<script type='text/javascript'>"
,"encode();"
, "</script>"

?>

</body>
</html>


Edited by kat35601
Link to comment
https://forums.phpfreaks.com/topic/298643-trying-to-add-a-barcode-to-my-page/
Share on other sites

  • Solution

I don't know what you are trying to do, but PHP and JavaScript are two completely different languages and one has no knowledge that the other even exists.

You can pass data to PHP through form fields, hidden and others or through ajax.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.