PL/SQL PSP Form not submitting values

136 Views Asked by At

I am pretty sure this is a syntax error I'm just not seeing it. I have a form to submit payment information to the database and load that into the invoice table. My output line is just to test what is coming through. The table receives an invoice_id, the sysdate, and the default for whats due, everything else null.

My form PSP:

    <%@ page language="PL/SQL"%>
<%@ plsql procedure="payment_details"%>
<%@plsql parameter="first_name_text" default="null"%>
<%@plsql parameter="last_name_text" default="null"%> 
<%@plsql parameter="email_text" default="null"%>
<%@plsql parameter="phone_text" default="null"%> 
<%@plsql parameter="reservation_id_text" default="null"%> 
<%@plsql parameter="formsbutton1" default="null"%>
<%! guest_id_text guest.guest_id%type; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="utf-8" />
    <title>Hotel Database</title>
    <style>
        p.inset {
            border-style: inset;
                margin:auto;
                width:250px;
        }
    </style>
</head>
<body>
 <div align="center">
            <p><h1>The Golden Key Hotel</h2>
               <h2>Hotel Reservation</h2></p>
            <a href="reservation_request">Create a Reservation</a> ||
            <a href="">View My Reservations</a> ||
            <a href="">Administrative View</a>
            <hr />
        </div>
<br>
<% 
insert into guest(guest_id, first_name, last_name, email, phone)
values(guest_sequence.nextval,first_name_text, last_name_text, email_text, phone_text);
commit;
select guest_sequence.currval into guest_id_text
from dual;
update reservation
set guest_id = guest_id_text
where reservation_id = reservation_id_text;
commit;
%>
<p>Guest <%=first_name_text%> with Guest ID  <%=guest_id_text%> for Reservation <%=reservation_id_text%> created.</p>
<br>
Enter Payment Details:
<form action="invoice_receipt" method="post">
Card Number: <input type="text"  name="cc_no_text" /><br>
Card Type: <input type="radio" name="cc_type_text" value="Visa"> Visa
             <input type="radio" name="cc_type_text" value="MasterCard"> MasterCard
             <input type="radio" name="cc_type_text" value="Discover"> Discover
             <input type="radio" name="cc_type_text" value="Travel"> Travel <br>
Exp Date (last day of month): <input type="date"  name="exp_date" /><br>
<input type="hidden" name="guest_id_text" value="<%=guest_id_text%>">
<input type="hidden" name="reservation_id_text" value="<%=reservation_id_text%>">
<input type="submit" name="FormsButton1" value="Submit"/>
</form>
<!-- End Page Content -->
<% exception
when others then %>
<%=sqlerrm%>
</body>
</html>

My receiving PSP:

<%@ page language="PL/SQL"%>
<%@ plsql procedure="invoice_receipt"%>
<%@plsql parameter="cc_type_text" default="null"%>
<%@plsql parameter="cc_no_text" default="null"%> 
<%@plsql parameter="exp_date_text" default="null"%>
<%@plsql parameter="guest_id_text" default="null"%> 
<%@plsql parameter="reservation_id_text" default="null"%> 
<%@plsql parameter="formsbutton1" default="null"%>
<%! invoice_id_text invoice.invoice_id%type; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="utf-8" />
    <title>Hotel Database</title>
    <style>
        p.inset {
            border-style: inset;
                margin:auto;
                width:250px;
        }
    </style>
</head>
<body>
 <div align="center">
            <p><h1>The Golden Key Hotel</h2>
               <h2>Hotel Reservation</h2></p>
            <a href="">reservation_request">Create a Reservation</a> ||
            <a href="">View My Reservations</a> ||
            <a href="">Administrative View</a>
            <hr />
        </div>
<br>
<% 
insert into invoice(invoice_id, invoice_date, invoice_due, cc_type, cc_no,
exp_date, guest_id, reservation_id)
values(invoice_sequence.nextval, sysdate, default, cc_type_text, cc_no_text,
to_date(exp_date_text, 'yyyy/mm/dd'), guest_id_text, reservation_id_text);
commit;
select invoice_sequence.currval into invoice_id_text
from dual; 
%>
<p>Invoice <%=invoice_id_text%> created on <%=sysdate%> with Reservation <%=reservation_id_text%> and a credit card of <%=cc_type_text%>.</p>
<br>

<!-- End Page Content -->
<% exception
when others then %>
<%=sqlerrm%>
</body>
</html>

The procedure:

create or replace procedure invoice_receipt (cc_type_text varchar2, 
cc_no_text varchar2, exp_date_text varchar2, 
guest_id_text varchar2,reservation_id_text varchar2, formsbutton1 varchar2)
is
invoice_id_text invoice.invoice_id%type; 
begin
insert into invoice(invoice_id, invoice_date, invoice_due, cc_type, cc_no,
exp_date, guest_id, reservation_id)
values(invoice_sequence.nextval,sysdate, default, cc_type_text, cc_no_text,
to_date(exp_date_text, 'yyyy/mm/dd'), guest_id_text, reservation_id_text);
commit;
select invoice_sequence.currval into invoice_id_text
from dual; 
dbms_output.put_line('Invoice '||invoice_id_text||' created on '||sysdate||' 
with Reservation '
||reservation_id_text||' and a credit card of '||cc_type_text);
end;
1

There are 1 best solutions below

0
On

My issue was in my initial form PSP. Simple typo error

What I had:

Exp Date (last day of month): <input type="date"  name="exp_date" /><br>

What I needed:

Exp Date (last day of month): <input type="date"  name="exp_date_text" /><br>