PL / SQL PSP表单未提交值

时间:2017-05-07 00:55:05

标签: html oracle plsql plsql-psp

我很确定这是一个语法错误,我只是没有看到它。我有一个表单,用于向数据库提交付款信息并将其加载到发票表中。我的输出线只是为了测试即将发生的事情。该表接收invoice_id,sysdate和什么是什么的默认值,其他一切都为null。

我的表格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>

我收到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>

程序:

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 个答案:

答案 0 :(得分:0)

我的问题出在我最初的PSP表格中。简单的拼写错误

我有什么:

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

我需要的是什么:

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