Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

need help with echo


  • Please log in to reply
No replies to this topic

#1 guitarzRus

guitarzRus

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Local time:01:45 PM

Posted 27 July 2022 - 12:00 AM

Hi, I'm trying to print a rental receipt. I enter a tenant name, amtpaid and amtdue into form and
expect to display the tenant name, amtpaid and balance due(if any). I'm also trying to update the
receiptno in the numberstbl and display the new one. I've tried echo, print and can't get the
values to display. please help.

the receipt code:
<?php
$server = "localhost";
$user = "root";
$password = "";
$dbname = "numbersdb";
 
// Create connection
$connection = mysqli_connect($server, $user, $password, $dbname);
// Check connection
if (!$connection) {
    die("Connection failed: " . mysqli_connect_error());
}
 
SET receiptno = $receiptno + 1 where id=$id";
 
if (mysqli_query($connection, $sql)) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . mysqli_error($connection);
}
 

$tenant=$_POST['tenant'];
$amtpaid=$_POST['amtpaid'];
$amtdue=$_POST['amtdue'];
$id="id";
$receiptno='receiptno';
$baldue = $amtdue - $amtpaid;

echo "receiptno is $receiptno";echo "<br />";
?>

<!DOCTYPE html><html>
<head>     

<script type="text/javascript">
var monthNames = [ "January","February","March","April","May","June","July",
  "August","September","October","November","December"     ];
var today = new Date();  
var date = monthNames[today.getMonth()] + " - " + today.getDate() + " - " + today.getFullYear();
</script>

</head>
<body><center><b>
<font size="+1">Rent Receipt</font><br>
Date: <script type="text/javascript">document.write(date);</script><p>
<img src="apt-pic.jpg" alt="apartment" height=250 width=800><br>

For:<SELECT name="options">
<option value="#990033" style="background-color: Violet;">Rent payment</option>
<option value="#003300" style="background-color: Aquamarine;">Background Check</option>
<option value="#6600cc" style="background-color: Pink;">Security Deposit Payment</option>
<option value="#003300" style="background-color: Aquamarine;">Damages Payment</option>
<option value="#990033" style="background-color: Violet;">Late Charges Payment</option>
<option value="#003300" style="background-color: Aquamarine;">Court Costs Payment</option>
<option value="#6600cc" style="background-color: Pink;">NSF Payment</option>
<option value="#990033" style="background-color: Violet;"> </option>
</SELECT><br>

<input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="Name" value="Business Name -">
<input type="text" size = 25 STYLE="color: #000000; background-color: #D4D4FF;" name="Addy1" value="Business address -">
<input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="Addy2" value="City, State, Zip"><br>
 
<b> tenant paying is: <?php echo $_POST["tenant"]; ?> -
Amount paid is: <?php echo $_POST["amtpaid"]; ?> -
echo "balance due is: $baldue";
</b><br>

<input type="text" size=85 name="sign" value="Management signature" STYLE="color:
#000000; font-weight: bold; background-color: #ffccff;" onFocus="this.value=''">
<input type="text" size=15 name="thanks" readonly value="We Thank You:" STYLE="color:
#000000; font-weight: bold; background-color: #ffccff;" onFocus="this.value=''"><br>
</b></center></body></html>

the result:
"; ?>
Rent Receipt
Date: July - 26 - 2022
tenant paying is: - Amount paid is: - echo "balance due is: $baldue";



BC AdBot (Login to Remove)

 





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users