HTML表单到PL / SQL

时间:2015-07-17 15:00:44

标签: html sql oracle web plsql

我无法思考如何向前推进的逻辑: 我正在尝试在网页上创建HTML表单,并且在该表单中将有2个输入文本框,我正在尝试将这些文本添加到数据库中的表中。顺便说一句,我在Toad中为oracle做这个。我正在制作将要添加到包中的程序。在此表之后,我假设另一个过程来检查文本框并将输入插入到表中。 继承我的代码:

CREATE OR REPLACE procedure PCSPRO.form_alfred

AS

BEGIN

htp.p (' 
 <form action="userINPUT" method="POST" NAME="INPUTFORM" >
      ');

 htp.p ('
  <table border="2" cellpadding="1" cellspacing="1" summary="">   

 <!--  Table -->

 <tr> Register New User </tr>



    <tr> <td>Employee ID: </td> 
         <td><input type="text" name="EmployeeID" value=""/></td></tr>

    <tr> <td>Employee Name: </td> 
         <td><input type="text" name="EmployeeName" value=""/></td></tr>
     ');

end;

1 个答案:

答案 0 :(得分:0)

我不确定我是否理解这个问题,但请看一下这个非常简单的例子:

CREATE OR REPLACE
PROCEDURE formPage
IS
BEGIN
    htp.prn('<!DOCTYPE html>
<html>
<head>
<title>simple form</title>
</head>
<body>
<form method="POST" action="formProcess">
<table>
<tr><td>First name:</td><td><input type="text" name="firstname"></td></tr>
<tr><td>Last name:</td><td><input type="text" name="lastname"></td></tr>
<tr><td colspan="2"><input type="radio" name="sex" value="male">Male</td></tr>
<tr><td colspan="2"><input type="radio" name="sex" value="female">Female</td></tr>
<tr><td colspan="2"><input type="checkbox" name="vehicle" value="Car">I have a car </td></tr>
<tr><td colspan="2"><input type="submit" value="Submit"></td></tr>
</table>
</form>
</body>
</html>');
END formPage;
/

CREATE OR REPLACE
PROCEDURE formProcess(firstname IN VARCHAR2, lastname IN VARCHAR2, sex IN VARCHAR2, vehicle IN VARCHAR2)
IS
BEGIN
    htp.prn('<!DOCTYPE html>
<html>
<head>
<title>simple form</title>
</head>
<body>
<table>
<tr><td>First name:</td><td>'||firstname||'</td></tr>
<tr><td>Last name:</td><td>'||lastname||'</td></tr>
<tr><td>Sex:</td><td>'||sex||'</td></tr>
<tr><td>Vehicle:</td><td>'||vehicle||'</td></tr>
</table>
</body>
</html>');
END formProcess;
/