redirect to receipt with variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bytM3
    New Member
    • May 2021
    • 6

    redirect to receipt with variables

    I make a payment using form. I then want(I think) to redirect to receipt with variables, tenant, rentpaid and
    rentdue to show on receipt. Suggestions please. this is offline application.
    Here are codes, payments.html, payments.php and rentreceipt.php :

    Code:
    <!DOCTYPE html><html lang="en">
        <head>
        </head>
        <body bgcolor="#ccffff"><center>
    <font size=+2><b> record a payment</font><br>   
        <form action="payment.php" method="post">
            <label for="unit">Unit:</label>
                <input type="text" name="unit" id="unit">
            <label for="tenant">Tenant:</label>
                <input type="text" name="tenant" id="tenant">
            <label for="rentpaid">Amt paid:</label>
                <input type="text" name="rentpaid" id="rentpaid">
    	<label for="hudpay">Hudpay:</label>
                <input type="text" name="hudpay" id="hudpay"><br>
            <label for="datepaid">Date Paid:</label>
                <input type="text" name="datepaid" id="datepaid">
            <label for="comments">Comments:</label>
                <input type="text" name="comments" id="comments"><br>
    
                    <input type="submit" name="submit" value="make a payment">
        </form></body></html>
    
    <?php
    echo "<center>";echo date('m/d/y');echo "</center>";
    $id="''";
    
    // Include config file
    require_once "getprerentdb.php";
    
    //MySqli Select Query
    $results = $mysqli->query("SELECT * FROM paytbl");
    
    /* --------------------------- below are posted from form ----- */
    $tenant=$_POST['tenant'];
    $unit=$_POST['unit'];
    $rentpaid=$_POST['rentpaid'];
    $hudpay=$_POST['hudpay'];
    $datepaid=$_POST['datepaid'];
    $comments=$_POST['comments'];
    /* --------------------------- above are posted from form ---- */
    
    $prevbal='prevbal';
    $latechg='latechg';
    $secdep='secdep';
    $damage='damage';
    $courtcost='courtcost';
    $nsf='nsf';
    $paidsum='paidsum';
    
    //$owe = $prevbal + $latechg + $secdep + $damage + $courtcost + $nsf;
    //$rentpaid=$owe; $paidsum=$owe;
    ?>
    
    <!DOCTYPE html><html>
    <head>
    
    <STYLE TYPE="text/css">
    .blue {background-color: #ccffff;}
    .tan {background-color: #FFD4FF;}
    h1.centered-cell {text-align: center;font-size: 1.1em;}
    </STYLE>
    
    </head>
    <body><center><b><font size=+1>Rent Payment</b><p>
    
    <?php
    $mysqli->query("Update paytbl SET
     rentpaid = '$rentpaid', datepaid = '$datepaid', paidsum = '$paidsum', hudpay = '$hudpay', 
    comments = '$comments' 
    where unit = '$unit'");
    ?>
         
    </center></body></html>
    
    <!DOCTYPE html><html>
    <head>
         <title>rent receipt</title>
    </head>
    <body><center>
    <?php
    echo "<center>";echo date('m/d/y');echo "<br />";
    
    // Include config file
    require_once "getprerentdb.php";
    
    //MySqli Select Query
    $results = $mysqli->query("SELECT * FROM numberstbl");
    $receiptno = "receiptno";
    $sql = " UPDATE numberstbl
         SET $receiptno = $receiptno + 1 where id=$id  ";
    echo "receiptno has been updated successfully !";
    echo "<center>";echo "Receiptno is $receiptno";echo "<br />";
    
    $tenant='tenant';
    $rentpaid='rentpaid';
    $rentdue='rentdue';
        ?>
    <font size=+1> 
    <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"> 
    
    <TABLE BORDER="0" CELLPADDING="12" CELLSPACING="5" >
       <TD>
    <TABLE BORDER="30" CELLPADDING="12" CELLSPACING="5">
    <td>
    <input type='text' size = 30 STYLE="color: #000000; background-color: #D4AAFF;" name="from" 
    value="<?php echo( htmlspecialchars($row['tenant'] ) ); ?>" /></td>
    <td><input type='text' size = 10 STYLE="color: #000000; background-color: D4D4FF;" name="Amount" 
    value="$ <?php echo( htmlspecialchars($row['Rentpaid'] ) ); ?>" /></td>
    <td><input type='text' size = 10 STYLE="color: #000000; background-color: D4D4FF;" name="Balance Due" 
    value="$ <?php echo( htmlspecialchars($row['Rentdue'] ) ); ?>" /></td>
    <tr>
    <td><input type="text" size="25" name="sign" value="Sign here" STYLE="color: 
    #000000; font-weight: bold; background-color: #ffccff;" onFocus="this.value=''"></td>
    <td colspan=2 align="center"><input type="text" size=15 name="thanks" readonly value="We Thank You:" STYLE="color: 
    #000000; font-weight: bold; background-color: #ffccff;" onFocus="this.value=''"></td>
    </tr></table>
    
    
    </b></body></html>
    Last edited by Niheel; May 17 '21, 07:42 AM.
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    I make a payment using form. I then want(I think) to redirect to receipt with variables, tenant, rentpaid and
    rentdue to show on receipt. Suggestions please.
    Separate the relevant code using [CODE] tags. You may need to use GET/POST or session or cookie.

    Comment

    Working...